private function getFunctionParameters(string $onEvent, callable $function, array $objects) : array
    {
        $parameters = [];

        $reflectionFunction = $this->reflectionTools->getReflectionFunction($function);

        foreach ($reflectionFunction->getParameters() as $reflectionParameter) {
            $parameterClass = $reflectionParameter->getClass();

            if ($parameterClass !== null) {
                $parameterClassName = $parameterClass->getName();

                if (isset($objects[$parameterClassName])) {
                    $parameters[] = $objects[$parameterClassName];

                    continue;
                }
            }

            throw $this->cannotResolveParameter($onEvent, array_keys($objects), $reflectionParameter);
        }

        return $parameters;
    }
private function getFunctionParameters(string $onEvent, callable $function, array $objects) : array
    {
        $parameters = [];

        $reflectionFunction = $this->reflectionTools->getReflectionFunction($function);

        foreach ($reflectionFunction->getParameters() as $reflectionParameter) {
            $parameterClass = $reflectionParameter->getClass();

            if ($parameterClass !== null) {
                $parameterClassName = $parameterClass->getName();

                if (isset($objects[$parameterClassName])) {
                    $parameters[] = $objects[$parameterClassName];

                    continue;
                }
            }

            throw $this->cannotResolveParameter($onEvent, array_keys($objects), $reflectionParameter);
        }

        return $parameters;
    }
private function getFunctionParameters ( string $ onEvent , callable $ function , array $ objects ) : array { $ parameters = [ ] ; $ reflectionFunction = $ this -> reflectionTools -> getReflectionFunction ( $ function ) ; foreach ( $ reflectionFunction -> getParameters ( ) as $ reflectionParameter ) { $ parameterClass = $ reflectionParameter -> getClass ( ) ; if ( $ parameterClass !== null ) { $ parameterClassName = $ parameterClass -> getName ( ) ; if ( isset ( $ objects [ $ parameterClassName ] ) ) { $ parameters [ ] = $ objects [ $ parameterClassName ] ; continue ; } } throw $ this -> cannotResolveParameter ( $ onEvent , array_keys ( $ objects ) , $ reflectionParameter ) ; } return $ parameters ; }
Resolves the parameters to call the given function.

@param string   $onEvent  'onBefore' or 'onAfter'.
@param callable $function The function to resolve.
@param object[] $objects  An associative array of available objects, indexed by their class or interface name.

@return array

@throws HttpInternalServerErrorException If the function requires a parameter that is not available.
Resolves the parameters to call the given function .