Set multiple properties as a key/val hash in one operation.

@param  array $ops
@return self
502277
public function setOptions(array $ops)
    {
        foreach ($ops as $key => $val) {
            $this->$key = $val;
        }

        return $this;
    }
637324
public function addProperties($properties)
    {
        foreach ($properties as $key => $value) {
            $this->setProperty($key, $value);
        }

        return $this;
    }
1154351
public function fill(array $properties)
    {
        foreach ($properties as $key => $value)
        {
            $this->setAttribute($key, $value);
        }

        return $this;
    }
55609
public function serializeOperations()
    {
        $datas = array();

        foreach ($this->operations as $operation) {
            $method = $operation[0];
            $args = $operation[1];

            foreach ($args as &$arg) {
                if ($arg instanceof self) {
                    $arg = $arg->getHash();
                }
            }

            $datas[] = array($method, $args);
        }

        return serialize($datas);
    }
1227272
public function setMultiple($values)
    {
        foreach ($values as $value) {
            self::set($value['key'], $value['value'], $ttl);
        }

        return self;
    }
694779
public function options(array $options): self
    {
        foreach ($options as $key => $value) {
            $this->set('options.'.$key, $value);
        }

        return $this;
    }
289821
public function setCredentials($ps_user, $ps_pass) {
		$this->ops_user = $ps_user;
		$this->ops_key = $ps_pass;
		return $this;
	}
758614
public function setMultipleProperties(array $properties)
    {
        $this->parseStyleAttribute();

        foreach ($properties as $propertyName => $value) {
            if (!is_string($propertyName)) {
                throw new InvalidArgumentException(sprintf('Property name must be a string, %s given', (is_object($propertyName) ? get_class($propertyName) : gettype($propertyName))));
            }

            if (!is_string($value)) {
                throw new InvalidArgumentException(sprintf('Property value must be a string, %s given', (is_object($value) ? get_class($value) : gettype($value))));
            }

            $this->properties[$propertyName] = $value;
        }

        $this->updateStyleAttribute();

        return $this;
    }
376846
private function beginBracket($op) {
        $this->currentWhere[] = [$op => []];
        $this->whereStack[] = &$this->currentWhere;
        end($this->currentWhere);
        $this->currentWhere = &$this->currentWhere[key($this->currentWhere)][$op];

        return $this;
    }
1217097
public static function optimize($operations)
    {
        $newOperations = [];
        /** @var $outOperation Operation */
        foreach ($operations as $outIndex => $outOperation) {
            $inOperations = array_slice($operations, $outIndex + 1);

            if ($inOperations) {
                foreach ($inOperations as $inIndex => $inOperation) {
                    // get how many items to fetch
                    $length = $inIndex;

                    $inBetween = array_slice($operations, $outIndex + 1, $length);

                    $result = $outOperation->reduce($inOperation, $inBetween);

                    if ($result) {
                        // add the result of the two merging
                        $newOperations = array_merge($newOperations, $result);
                        // add points that fell in between those that merged
                        $newOperations = array_merge($newOperations, $inBetween);
                        // add points that come after
                        $newOperations = array_merge(
                            $newOperations,
                            array_slice($operations, $outIndex + $inIndex + 2)
                        );

                        return $newOperations;
                    }
                }
                $newOperations[] = $outOperation;
            } else {
                $newOperations[] = $outOperation;
            }
        }

        return $newOperations;
    }
587307
private function prepareOperations(array $operations)
    {
        foreach ($operations as $operation => &$config) {
            $config['uri'] = ltrim($config['url'], '/');
            unset($config['url']);

            $config['httpMethod'] = strtoupper($config['method']);
            unset($config['method']);
            if (strpos($config['httpMethod'], '/') !== false) {
                $config['httpMethod'] = explode('/', $config['httpMethod'])[0];
            }

            if (isset($config['responseTypes']) && count($config['responseTypes']) === 1) {
                $class = ucwords($config['resource']).'\\';
                $class .= str_replace(' ', '', ucwords($config['responseTypes'][0]['name']));

                $config['responseModel'] = $class;
            } else {
                $config['responseModel'] = 'getResponse';
            }

            if (isset($config['parametersArray']) && $config['parametersArray']) {
                $config['type'] = 'array';
            }
            unset($config['parametersArray']);

            foreach ($config['parameters'] as $parameter => &$parameterConfig) {
                $this->updateParameterTypes($parameterConfig);
                if (!isset($parameterConfig['required'])) {
                    $parameterConfig['required'] = false;
                }
            }
        }

        return $operations;
    }
83545
public function rellenar(array $datos)
    {
        foreach ($datos as $llave => $valor) {
            $this->$llave = $valor;
        }

        return $this;
    }
1212972
public function setFieldsFromArray(Array $fields) {
    foreach ($fields as $field => $value) {
      $this->set($field, $value);
    }
    return $this;
  }
383278
public function patch(array $operations)
    {
        $patch = new Patch($operations);
        $data  = $patch->patch($this->_properties);

        $this->_properties = $data;
    }
778478
public function setProperties(array $properties = [])
    {
        foreach ($properties as $property => $value) {
            $method = 'set'.ucfirst($property);
            if (!method_exists($this, $method)) {
                throw new \RuntimeException("Undefined method $method.");
            }

            if (!in_array($property, $this->validProperties)) {
                throw new \Exception('You are trying to set invalid properties. Please check valid properties.');
            }

            $this->{$method}($value);
        }
    }
939705
public static function fromProperties(array $properties)
    {
        $copy = new self();
        foreach (self::getPropertyNames() as $name) {
            if (isset($properties[$name])) {
                $copy->{'set'.ucfirst($name)}($properties[$name]);
            }
        }

        return $copy;
    }
387705
public function bitOp($operation, $destination, $key, ...$keys) {
        return $this->send(array_merge(['bitop', $operation, $destination], (array) $key, $keys));
    }