Process parameters

@param  Element $parameters
@return object
550366
protected function processParameters(Element $parameters) {
		$definitions = new stdClass();
		
		foreach ($parameters as $parameter) {
			if ($parameter->getName() !== 'parameter') {
				throw new InvalidConfig('Unknown element "' . $parameter->getName() . ' in parameters section"', null, null, $parameter);
			}
			
			if (! isset($parameter->name)) {
				throw new InvalidConfig('Definition of parameter must contain the "name" attribute', null, null, $parameter);
			}
			
			if (! $this->override && isset($definitions->{$parameter->name})) {
				throw new InvalidConfig('Parameter "' . $parameter->name . '" is already been set and cannot be overridden', null, null, $parameter);
			}
			
			$definitions->{$parameter->name} = $this->processArgument($parameter);
		}
		
		return $definitions;
	}
689422
protected function processArgument(Element $arg) {
		// Value of the special types:
		if (isset($arg->type)) {
			$type = strtolower(trim($arg->type));
			
			switch ($type) {
				case 'bool':
				case 'boolean':
					return $this->processArgumentBoolean($arg);
					
				case 'service':
					return $this->processArgumentService($arg);
					
				case 'parameter':
					return $this->processArgumentParameter($arg);
					
				case 'null':
					return $this->processArgumentNull($arg);
					
				case 'array':
					return $this->processArgumentArray($arg);
			}
			
			throw new InvalidConfig('Invalid type of argument: "' . $type . '"', null, null, $arg);
		}
		
		// Scalar value: string, int, float
		$definition = new stdClass();
		
		if (isset($arg->value)) {
			$definition->type  = 'value';
			$definition->value = Std::parseValue($arg->value);
			
			return $definition;
		}
		
		$value = $arg->getValue();
		
		if (! empty($value)) {
			$definition->type  = 'value';
			$definition->value = Std::parseValue($value);
			
			return $definition;
		}
		
		throw new InvalidConfig('Invalid definition of argument', null, null, $arg);
	}
1124290
public function parseScenarioParameters(array &$parameters, $checkExp = false) {
        foreach ($parameters as $key => $value) {
            if ($this->isScenarioParameter($value, $checkExp)) {
                $parameters[$key] = $this->getScenarioParameter($value);
            }
        }
        return $parameters;
    }
1275948
public function curry($parameters)
    {
        $parameters = is_array($parameters) ? $parameters : func_get_args();
        return $this->append(static::currify($parameters));
    }
33206
public function post($parameters = null)
    {
        $this->setOption(CURLOPT_POST, true);
        if ($parameters !== null) {
            $this->setParameters($parameters);
        }

        return $this->execute();
    }
61410
private function castObjectsAsArrays(array $parameters)
    {
        foreach ($parameters as $key => $value) {
            if (is_object($value)) {
                $value = (array) $value;
                $parameters[$key] = $value;
            }
            if (is_array($value)) {
                $parameters[$key] = $this->castObjectsAsArrays($value);
            }
        }
        return $parameters;
    }
102567
public function getObject(array $parameters = array())
    {
        if ($this->url === null) {
            throw new \InvalidArgumentException('Missing URL.');
        }

        if ($this->endpoint === null) {
            $this->endpoint = $this->discover($this->url);
        }

        $sign = '?';
        if ($query = parse_url($this->endpoint, PHP_URL_QUERY)) {
            $sign = '&';

            parse_str($query, $parameters);
        }

        if (!isset($parameters['url'])) {
            $parameters['url'] = $this->url;
        }
        if (!isset($parameters['format'])) {
            $parameters['format'] = 'json';
        }

        $client = new Client(
            sprintf('%s%s%s', $this->endpoint, $sign, http_build_query($parameters))
        );

        $data = $client->send();

        switch ($parameters['format']) {
            case 'json':
                $data = json_decode($data);
                if (!is_object($data)) {
                    throw new \InvalidArgumentException('Could not parse JSON response.');
                }

                break;

            case 'xml':
                libxml_use_internal_errors(true);
                $data = simplexml_load_string($data);
                if (!$data instanceof \SimpleXMLElement) {
                    $errors = libxml_get_errors();
                    $error  = array_shift($errors);
                    libxml_clear_errors();
                    libxml_use_internal_errors(false);
                    throw new \InvalidArgumentException($error->message, $error->code);
                }

                break;
        }

        return Object::factory($data);
    }
568474
protected function cleanParameters( array $parameters )
    {
        foreach ($parameters as $parameter => $value) {
            if (is_int( $parameter )) {
                unset( $parameters[$parameter] );
            }
        }
        return $parameters;
    }
1271933
public static function parameters(array $parameters)
    {
        $args = array();
        foreach ($parameters as $param) {
            $arg = '';

            if ($param->isPassedByReference()) {
                $arg .= '&';
            }

            $arg .= '$' . $param->getName();

            if ($param->isOptional()) {
                $arg .= ' = ';

                switch (true) {
                    case null === $param->getDefaultValue():
                        $arg .= 'null';
                        break;
                    case is_array($param->getDefaultValue()):
                        $arg .= 'array()';
                        break;
                    case is_bool($param->getDefaultValue()):
                        $arg .= $param->getDefaultValue() ? 'true' : 'false';
                        break;
                    case is_int($param->getDefaultValue()):
                        $arg .= $param->getDefaultValue();
                        break;
                    default:
                        $arg .= '\'' . str_replace('\'', '\\\'', $param->getDefaultValue()) . '\'';
                        break;
                }
            }

            $args[] = $arg;
        }

        return $args;
    }
290927
private function createRequestBody(array $parameters): array
    {
        $resources = [];
        foreach ($parameters as $key => $values) {
            if (!is_array($values)) {
                $values = [$values];
            }
            foreach ($values as $value) {
                $resources[] = [
                    'name' => $key,
                    'content' => $value,
                ];
            }
        }

        return $resources;
    }
222597
public function setParameters(array $parameters)
    {
        $this->storage = new \ArrayObject();
        foreach ($parameters as $parameterName => $parameterValue) {
            $this->setParameter($parameterName, $parameterValue);
        }

        return $this;
    }
1291403
private function makeParameters(array $parameters): array
    {
        return array_map(function (ReflectionParameter $parameter) {
            $class = $parameter->getClass();

            if ($class instanceof ReflectionClass) {
                return $this->make($class->getName());
            }

            if ($parameter->isDefaultValueAvailable()) {
                return $parameter->getDefaultValue();
            }

            return null;
        }, $parameters);
    }
1078590
public function AddParameter(\Peg\Lib\Definitions\Element\Parameter $parameter)
    {
        $parameter->overload =& $this;
        
        if(!isset($this->parameters[$parameter->name]))
        {
            $this->parameters[$parameter->name] = $parameter;
        }
        else
        {
            /*throw new \Exception(
                sprintf(
                    t("You are trying to add a parameter which is already listed: %s"),
                    $parameter->name
                )
            );*/
        }
        
        return $this;
    }
1113432
public function delete(array $parameters = []) {
        if (!$this->canAlter()) {
            throw new Exception('Need index, type, and key to delete a document');
        }
        if (!$this->esClient) {
            throw new Exception('Need ElasticSearch client object for ALTER operations');
        }
        $params = [
            'index' => $this->meta['index'],
            'type' => $this->meta['type'],
            'id' => $this->meta['id']] + $parameters;
        $result = $this->esClient->delete($params);
        return $result;
    }
261700
public function withParameters(array $parameters): self
    {
        $this->parameters = [];
        foreach ($parameters as $name => $value) {
            $this->withParameter($name, $value);
        }

        return $this;
    }
525525
public function bind(array $parameters = [])
    {
        foreach ($this->formProperties as $key => $property) {
            if (isset($parameters[$property['uri']])) {
                $value = $parameters[$property['uri']];
            } else {
                $value = '';
            }
            $this->formProperties[$key]['formValue'] = $value;
        }
        return $this;
    }
931384
public function transform(array $parameters)
    {
        $transformed = array();

        foreach ($parameters as $name => $value) {
            $transformed[$name] = $this->transformerResolver->resolve($value)->transform($value);
        }

        return $transformed;
    }