private function getDependencyInjectionParameter(\ReflectionParameter $reflectionParameter, array &$arguments, array $argumentsClass)
    {
        // Parameter name in arguments list?
        if (array_key_exists($reflectionParameter->getName(), $arguments)) {
            $parameter = $arguments[$reflectionParameter->getName()];

            // Remove argument to do not use again
            unset($arguments[$reflectionParameter->getName()]);

            return $parameter;
        }

        // Parameter is class?
        if ($reflectionParameter->hasType() && !$reflectionParameter->getType()->isBuiltin()) {
            // Parameter type is in arguments class?
            if (array_key_exists($reflectionParameter->getType()->getName(), $argumentsClass)) {
                $argumentsFound = $argumentsClass[$reflectionParameter->getType()->getName()];

                // Argument is already available?
                if (($argumentFound = reset($argumentsFound)) !== false && isset($arguments[$argumentFound])) {
                    $parameter = $arguments[$argumentFound];

                    // Remove argument to do not use again
                    unset($arguments[$argumentFound]);

                    return $parameter;
                }
            }

            if (!is_null($this->getContainer())) {
                // Service exists with the same name and same type?
                if ($this->getContainer()->has($reflectionParameter->getName())
                    && is_a($service = $this->getContainer()->get($reflectionParameter->getName()), $reflectionParameter->getType()->getName())) {
                    return $service;
                }

                // Service exists with same class?
                if ($this->getContainer()->has($reflectionParameter->getType()->getName())
                    && is_a($service = $this->getContainer()->get($reflectionParameter->getType()->getName()), $reflectionParameter->getType()->getName())) {
                    return $service;
                }
            }
        }

        if ($reflectionParameter->isDefaultValueAvailable()) {
            try {
                return $reflectionParameter->getDefaultValue();
            } catch (\Exception $e) {
                throw new InstantiatorException(sprintf('Unable to get default value of parameter "%s"', $reflectionParameter->getName()));
            }
        } else {
            if ($reflectionParameter->allowsNull()) {
                return null;
            } else {
                throw new InstantiatorException(sprintf('Missing parameter "%s"', $reflectionParameter->getName()));
            }
        }
    }
private function getDependencyInjectionParameter(\ReflectionParameter $reflectionParameter, array &$arguments, array $argumentsClass)
    {
        // Parameter name in arguments list?
        if (array_key_exists($reflectionParameter->getName(), $arguments)) {
            $parameter = $arguments[$reflectionParameter->getName()];

            // Remove argument to do not use again
            unset($arguments[$reflectionParameter->getName()]);

            return $parameter;
        }

        // Parameter is class?
        if ($reflectionParameter->hasType() && !$reflectionParameter->getType()->isBuiltin()) {
            // Parameter type is in arguments class?
            if (array_key_exists($reflectionParameter->getType()->getName(), $argumentsClass)) {
                $argumentsFound = $argumentsClass[$reflectionParameter->getType()->getName()];

                // Argument is already available?
                if (($argumentFound = reset($argumentsFound)) !== false && isset($arguments[$argumentFound])) {
                    $parameter = $arguments[$argumentFound];

                    // Remove argument to do not use again
                    unset($arguments[$argumentFound]);

                    return $parameter;
                }
            }

            if (!is_null($this->getContainer())) {
                // Service exists with the same name and same type?
                if ($this->getContainer()->has($reflectionParameter->getName())
                    && is_a($service = $this->getContainer()->get($reflectionParameter->getName()), $reflectionParameter->getType()->getName())) {
                    return $service;
                }

                // Service exists with same class?
                if ($this->getContainer()->has($reflectionParameter->getType()->getName())
                    && is_a($service = $this->getContainer()->get($reflectionParameter->getType()->getName()), $reflectionParameter->getType()->getName())) {
                    return $service;
                }
            }
        }

        if ($reflectionParameter->isDefaultValueAvailable()) {
            try {
                return $reflectionParameter->getDefaultValue();
            } catch (\Exception $e) {
                throw new InstantiatorException(sprintf('Unable to get default value of parameter "%s"', $reflectionParameter->getName()));
            }
        } else {
            if ($reflectionParameter->allowsNull()) {
                return null;
            } else {
                throw new InstantiatorException(sprintf('Missing parameter "%s"', $reflectionParameter->getName()));
            }
        }
    }
private function getDependencyInjectionParameter ( \ ReflectionParameter $ reflectionParameter , array & $ arguments , array $ argumentsClass ) { // Parameter name in arguments list? if ( array_key_exists ( $ reflectionParameter -> getName ( ) , $ arguments ) ) { $ parameter = $ arguments [ $ reflectionParameter -> getName ( ) ] ; // Remove argument to do not use again unset ( $ arguments [ $ reflectionParameter -> getName ( ) ] ) ; return $ parameter ; } // Parameter is class? if ( $ reflectionParameter -> hasType ( ) && ! $ reflectionParameter -> getType ( ) -> isBuiltin ( ) ) { // Parameter type is in arguments class? if ( array_key_exists ( $ reflectionParameter -> getType ( ) -> getName ( ) , $ argumentsClass ) ) { $ argumentsFound = $ argumentsClass [ $ reflectionParameter -> getType ( ) -> getName ( ) ] ; // Argument is already available? if ( ( $ argumentFound = reset ( $ argumentsFound ) ) !== false && isset ( $ arguments [ $ argumentFound ] ) ) { $ parameter = $ arguments [ $ argumentFound ] ; // Remove argument to do not use again unset ( $ arguments [ $ argumentFound ] ) ; return $ parameter ; } } if ( ! is_null ( $ this -> getContainer ( ) ) ) { // Service exists with the same name and same type? if ( $ this -> getContainer ( ) -> has ( $ reflectionParameter -> getName ( ) ) && is_a ( $ service = $ this -> getContainer ( ) -> get ( $ reflectionParameter -> getName ( ) ) , $ reflectionParameter -> getType ( ) -> getName ( ) ) ) { return $ service ; } // Service exists with same class? if ( $ this -> getContainer ( ) -> has ( $ reflectionParameter -> getType ( ) -> getName ( ) ) && is_a ( $ service = $ this -> getContainer ( ) -> get ( $ reflectionParameter -> getType ( ) -> getName ( ) ) , $ reflectionParameter -> getType ( ) -> getName ( ) ) ) { return $ service ; } } } if ( $ reflectionParameter -> isDefaultValueAvailable ( ) ) { try { return $ reflectionParameter -> getDefaultValue ( ) ; } catch ( \ Exception $ e ) { throw new InstantiatorException ( sprintf ( 'Unable to get default value of parameter "%s"' , $ reflectionParameter -> getName ( ) ) ) ; } } else { if ( $ reflectionParameter -> allowsNull ( ) ) { return null ; } else { throw new InstantiatorException ( sprintf ( 'Missing parameter "%s"' , $ reflectionParameter -> getName ( ) ) ) ; } } }
Get parameter value for injection.

@param \ReflectionParameter $reflectionParameter
@param array                $arguments
@param array                $argumentsClass

@return mixed|null
@throws \Berlioz\ServiceContainer\Exception\InstantiatorException
Get parameter value for injection .