This method creates an array from the parameters, using parameters' name as keys
and taking values or default values.
It is used to prepare args for events listening.

@param string $class_method
@param mixed[] $parameterValues
172060
public function makeArrayFromParameters($class_method, $parameterValues)
	{
	    if (empty($class_method))
	        return array();
	    
	    // Get the class name and the method name
	    list($className, $methodName) = explode('::', $class_method);
	    if (empty($className) || empty($methodName))
	        return array();
	    
	    /**
	     * Build an array from the parameters
	     * Parameters' name will become keys
	     * Values will be parameters' values or default values
	     */ 
	    $parametersArray = array();
	    try 
	    {
	        // Gets the data of class/method from Reflection object
    	    $reflectionMethod = new \ReflectionMethod($className, $methodName);
    	    $parameters = $reflectionMethod->getParameters();
    	    
    	    // Loop on parameters
    	    foreach ($parameters as $keyParameter => $parameter)
    	    {
    	        // Check if we have a value given
    	        if (!empty($parameterValues[$keyParameter]))
    	            $parametersArray[$parameter->getName()] = $parameterValues[$keyParameter];
    	            else
    	                // No value given, check if parameter has an optional value
    	                if ($parameter->isOptional())
    	                    $parametersArray[$parameter->getName()] = $parameter->getDefaultValue();
    	                    else
    	                        // Else
    	                        $parametersArray[$parameter->getName()] = null;
    	    }
	    }
	    catch (\Exception $e)
	    {
	        // Class or method were not found
	        return array();
	    }
	    
	    return $parametersArray;
	}
999589
public static <T> QueryParameterValue array(T[] array, Class<T> clazz) {
    return array(array, classToType(clazz));
  }
70556
private function classMethodCall($class_name, $colon_node, $method_name) {
    $node = new ClassMethodCallNode();
    $node->addChild($class_name, 'className');
    $node->mergeNode($colon_node);
    $node->addChild($method_name, 'methodName');
    $this->functionCallParameterList($node);
    return $this->objectDereference($this->arrayDeference($node));
  }
141843
private function getMethodParameters(string $class, string $methodName) : array
    {
        $methodReflection = new ReflectionMethod($class, $methodName);
        $parametersName   = [];

        foreach ($methodReflection->getParameters() as $parameter) {
            $parametersName[] = $parameter->name;
        }

        return $parametersName;
    }
707804
def parameters
      self.class.parameters.each_with_object({}) do |parameter, hash|
        hash[parameter.name] = send(parameter.name)
      end
    end
1137489
public function queryObjArray($query, $className, $options = array(), $classConstructorArguments = NULL)
    {
        if (!class_exists($className)) {
            $this->_error(FQDBException::CLASS_NOT_EXIST, FQDBException::FQDB_CODE);
        }

        return $this->queryArray($query, $options,
            function(\PDOStatement $statement) use ($className, $classConstructorArguments) {
                return $statement->fetchAll(\PDO::FETCH_CLASS | \PDO::FETCH_PROPS_LATE,
                    $className, $classConstructorArguments);
            }
        );
    }
1000614
private function bindTypedParameters()
    {
        $streams = $values = [];
        $types   = $this->types;

        foreach ($this->_bindedValues as $parameter => $value) {
            if (! isset($types[$parameter - 1])) {
                $types[$parameter - 1] = static::$_paramTypeMap[ParameterType::STRING];
            }

            if ($types[$parameter - 1] === static::$_paramTypeMap[ParameterType::LARGE_OBJECT]) {
                if (is_resource($value)) {
                    if (get_resource_type($value) !== 'stream') {
                        throw new InvalidArgumentException('Resources passed with the LARGE_OBJECT parameter type must be stream resources.');
                    }
                    $streams[$parameter] = $value;
                    $values[$parameter]  = null;
                    continue;
                }

                $types[$parameter - 1] = static::$_paramTypeMap[ParameterType::STRING];
            }

            $values[$parameter] = $value;
        }

        if (! $this->_stmt->bind_param($types, ...$values)) {
            throw new MysqliException($this->_stmt->error, $this->_stmt->sqlstate, $this->_stmt->errno);
        }

        $this->sendLongData($streams);
    }
1153948
private function getEnumeratedParameterList($parameter_name, $param_array) {
            $result = [];
            if ($param_array) {
                foreach ($param_array as $k => $v) {
                    $result[ ':' . $parameter_name . '_' . $k ] = $v;
                }
            }

            return $result;
        }
743895
public function buildMethodOptions(array &$_params, array $getDefinedVars)
    {
        return array_walk(
            array_merge(
                array_filter(
                    array_keys($getDefinedVars), function($key) {
                        return $key[0] !== "_";
                    }
                ),
                $_params
            ),
            function(&$value) {
                $value = str_replace("_", "-", $value);
            }
        );
    }
317648
protected function getClosure(string $class_name, string $class_key): callable
    {
        $parent_class_names = class_parents($class_name);
        $all_class_names    = $parent_class_names;
        $all_class_names[]  = $class_name;

        $class                      = new \ReflectionClass($class_name);
        $constructor                = $class->getConstructor(); // Null if no constructor.
        $class_rule                 = $this->getRule($class_name, $class_key, $parent_class_names);
        $constructor_params_closure = $constructor ? $this->getParamsClosure($constructor, $class_rule) : null;

        if (!$this->rules['*']['new_instances'] || !array_intersect($all_class_names, $this->rules['*']['new_instances'])) {
            return function (array $args) use ($class, $class_key, $constructor, $constructor_params_closure) {
                if ($constructor && $constructor_params_closure) {
                    return $this->instances[$class_key] = $class->newInstanceArgs($constructor_params_closure($args));
                } else {
                    return $this->instances[$class_key] = $class->newInstanceWithoutConstructor();
                }
            };
        } elseif ($constructor && $constructor_params_closure) {
            return function (array $args) use ($class, $constructor_params_closure) {
                return $class->newInstanceArgs($constructor_params_closure($args));
            };
        } else {
            return function (array $args) use ($class) {
                return $class->newInstanceWithoutConstructor();
            };
        }
    }
434217
protected static function fromClassMethodString($uses)
    {
        [$class, $method] = Str::parseCallback($uses);

        if (! method_exists($class, $method) && is_callable($class, $method)) {
            return [];
        }

        return (new ReflectionMethod($class, $method))->getParameters();
    }
1141832
function _setParams( $params, $defaults=FALSE ) {
    if( !is_array( $params))
      $params = array();
    $input = array();
    foreach( $params as $paramKey => $paramValue ) {
      if( is_array( $paramValue )) {
        foreach( $paramValue as $pkey => $pValue ) {
          if(( '"' == substr( $pValue, 0, 1 )) && ( '"' == substr( $pValue, -1 )))
            $paramValue[$pkey] = substr( $pValue, 1, ( strlen( $pValue ) - 2 ));
        }
      }
      elseif(( '"' == substr( $paramValue, 0, 1 )) && ( '"' == substr( $paramValue, -1 )))
        $paramValue = substr( $paramValue, 1, ( strlen( $paramValue ) - 2 ));
      if( 'VALUE' == strtoupper( $paramKey ))
        $input['VALUE']                 = strtoupper( $paramValue );
      else
        $input[strtoupper( $paramKey )] = $paramValue;
    }
    if( is_array( $defaults )) {
      foreach( $defaults as $paramKey => $paramValue ) {
        if( !isset( $input[$paramKey] ))
          $input[$paramKey] = $paramValue;
      }
    }
    return (0 < count( $input )) ? $input : null;
  }
226113
private function executeCommand($class, string $method, bool $server, $bindParams)
    {
        $this->beforeCommand(\get_parent_class($class), $method, $server);
        PhpHelper::call([$class, $method], $bindParams);
        $this->afterCommand($method, $server);
    }
169142
static function getAnnotationParam($name, $param, $class, $method = NULL, $default = NULL)
	{
		$annotation = self::getAnnotation($name, $class, $method, TRUE);

		return NULL === $annotation || !isset($annotation->{$param})
			? $default
			: $annotation->{$param};
	}
111574
private function prepareActualParameters(array $formalParameters, array $parameters): array
    {
        $result = [];

        // Handle named parameters
        if ($this->isNamedArray($parameters)) {

            foreach ($formalParameters as $formalParameter) {
                /** @var \ReflectionParameter $formalParameter */

                $formalType = (string) $formalParameter->getType();
                $name       = $formalParameter->name;

                if ($formalParameter->isOptional()) {
                    if (!array_key_exists($name, $parameters)) {
                        $result[$name] = $formalParameter->getDefaultValue();
                        continue;
                    }

                    if ($formalParameter->allowsNull() && $parameters[$name] === null) {
                        $result[$name] = $parameters[$name];
                        continue;
                    }

                    $result[$name] = $formalParameter->getClass() !== null
                        ? $this->toObject($formalParameter->getClass()->name, $parameters[$name])
                        : $this->matchType($formalType, $parameters[$name]);
                }

                if (!array_key_exists($name, $parameters)) {
                    throw new InvalidParamsException('Named parameter error');
                }

                $result[$name] = $this->matchType($formalType, $parameters[$name]);
            }

            return $result;
        }

        // Handle positional parameters
        foreach ($formalParameters as $position => $formalParameter) {
            /** @var \ReflectionParameter $formalParameter */

            if ($formalParameter->isOptional() && !isset($parameters[$position])) {
                break;
            }

            if (!isset($parameters[$position])) {
                throw new InvalidParamsException('Positional parameter error');
            }

            $formalType = (string) $formalParameter->getType();
            $result[] = $formalParameter->getClass() !== null
                ? $this->toObject($formalParameter->getClass()->name, $parameters[$position])
                : $this->matchType($formalType, $parameters[$position]);
        }

        return $result;
    }
1330186
private function invokeBefore(array $namedParams, array $classParams)
    {
        $invoker = new Invoker();
        foreach ($this->before as $function) {
            $response = $invoker->invoke($function, $namedParams, $classParams);
            if ($response !== null) {
                return $response;
            }
        }
    }
206388
def _preprocess_params(cls, kwargs):
        
        # kwargs.pop('csrf_token', None)
        for attr, val in kwargs.items():
            if cls.is_the_primary_key(attr) and cls._prevent_primary_key_initialization_:
                del kwargs[attr]
                continue
            if val == "":
                # Making an assumption that there is no good usecase
                # for setting an empty string. This will help prevent
                # cases where empty string is sent because of client
                # not clearing form fields to null
                kwargs[attr] = None
                continue
            if attr in class_mapper(cls).relationships and attr not in cls._no_overwrite_:
                rel = class_mapper(cls).relationships[attr]
                if rel.uselist:
                    if isinstance(val, list):
                        if all(isinstance(v, dict) for v in val):
                            rel_cls = cls.mapped_rel_class(attr)
                            kwargs[attr] = rel_cls.update_or_new_all(
                                list_of_kwargs=val, keys=[rel_cls.primary_key_name()])
                    elif isinstance(val, dict):
                        rel_cls = cls.mapped_rel_class(attr)
                        mapping_col = rel.collection_class().keyfunc.name
                        list_of_kwargs = [merge(v, {mapping_col: k}) for k, v in val.items()]
                        kwargs[attr] = {getattr(obj, mapping_col): obj for obj in rel_cls.update_or_new_all(
                            list_of_kwargs=list_of_kwargs, keys=[rel_cls.primary_key_name()])}
                elif isinstance(val, dict):
                    rel_cls = cls.mapped_rel_class(attr)
                    kwargs[attr] = rel_cls.update_or_new(
                        **merge(val, {'keys': [rel_cls.primary_key_name()]}))
        return kwargs