src/Injector.php
private function getFunctionParameters(\ReflectionFunctionAbstract $function, array $parameters = []) : array
    {
        $result = [];

        foreach ($function->getParameters() as $parameter) {
            $name = $parameter->getName();

            if (array_key_exists($name, $parameters)) {
                $value = $parameters[$name];
            } else {
                $value = $this->resolver->getParameterValue($parameter);
            }

            if ($parameter->isVariadic()) {
                $result = array_merge($result, $value);
            } else {
                $result[] = $value;
            }
        }

        return $result;
    }
private function getFunctionParameters(\ReflectionFunctionAbstract $function, array $parameters = []) : array
    {
        $result = [];

        foreach ($function->getParameters() as $parameter) {
            $name = $parameter->getName();

            if (array_key_exists($name, $parameters)) {
                $value = $parameters[$name];
            } else {
                $value = $this->resolver->getParameterValue($parameter);
            }

            if ($parameter->isVariadic()) {
                $result = array_merge($result, $value);
            } else {
                $result[] = $value;
            }
        }

        return $result;
    }
private function getFunctionParameters ( \ ReflectionFunctionAbstract $ function , array $ parameters = [ ] ) : array { $ result = [ ] ; foreach ( $ function -> getParameters ( ) as $ parameter ) { $ name = $ parameter -> getName ( ) ; if ( array_key_exists ( $ name , $ parameters ) ) { $ value = $ parameters [ $ name ] ; } else { $ value = $ this -> resolver -> getParameterValue ( $ parameter ) ; } if ( $ parameter -> isVariadic ( ) ) { $ result = array_merge ( $ result , $ value ) ; } else { $ result [ ] = $ value ; } } return $ result ; }
Returns an associative array of parameters to call a given function.

The parameters are indexed by name, and returned in the same order as they are defined.

@param \ReflectionFunctionAbstract $function   The reflection of the function.
@param array                       $parameters An optional array of parameters indexed by name.

@return array The parameters to call the function with.

@throws UnresolvedValueException If a function parameter could not be resolved.
Returns an associative array of parameters to call a given function .