protected function resolveParameter(ReflectionParameter $parameter, $value)
    {
        // If there is no class for the given parameter
        // then some kind of primitive data has been provided
        // and thus we need only to return it.
        $paramClass = $parameter->getClass();
        if ( ! isset($paramClass)) {
            return $value;
        }

        // Fetch the name of the class
        $className = $paramClass->getName();

        // If the value corresponds to the given expected class,
        // then there is no need to resolve anything from the
        // IoC service container.
        if ($value instanceof $className) {
            return $value;
        }

        $container = $this->container();

        // Fail if no service container is available
        if (is_null($container)) {
            $message = sprintf(
                'No IoC service container is available, cannot resolve property "%s" of the type "%s"; do not know how to populate with "%s"',
                $parameter->getName(),
                $className,
                var_export($value, true)
            );
            throw new BindingResolutionException($message);
        }

        // Get the resolved instance for the IoC container
        $instance = $container->make($className);

        // From Laravel 5.4, the Container::make method no longer accepts
        // parameters, which is really sad... Nevertheless, we attempt to
        // resolve this, simply by checking if the instance can be
        // populated with the given value, which is exactly what the
        // `resolveInstancePopulation` method does.
        return $this->resolveInstancePopulation($instance, $parameter, $value);
    }
protected function resolveParameter(ReflectionParameter $parameter, $value)
    {
        // If there is no class for the given parameter
        // then some kind of primitive data has been provided
        // and thus we need only to return it.
        $paramClass = $parameter->getClass();
        if ( ! isset($paramClass)) {
            return $value;
        }

        // Fetch the name of the class
        $className = $paramClass->getName();

        // If the value corresponds to the given expected class,
        // then there is no need to resolve anything from the
        // IoC service container.
        if ($value instanceof $className) {
            return $value;
        }

        $container = $this->container();

        // Fail if no service container is available
        if (is_null($container)) {
            $message = sprintf(
                'No IoC service container is available, cannot resolve property "%s" of the type "%s"; do not know how to populate with "%s"',
                $parameter->getName(),
                $className,
                var_export($value, true)
            );
            throw new BindingResolutionException($message);
        }

        // Get the resolved instance for the IoC container
        $instance = $container->make($className);

        // From Laravel 5.4, the Container::make method no longer accepts
        // parameters, which is really sad... Nevertheless, we attempt to
        // resolve this, simply by checking if the instance can be
        // populated with the given value, which is exactly what the
        // `resolveInstancePopulation` method does.
        return $this->resolveInstancePopulation($instance, $parameter, $value);
    }
protected function resolveParameter ( ReflectionParameter $ parameter , $ value ) { // If there is no class for the given parameter // then some kind of primitive data has been provided // and thus we need only to return it. $ paramClass = $ parameter -> getClass ( ) ; if ( ! isset ( $ paramClass ) ) { return $ value ; } // Fetch the name of the class $ className = $ paramClass -> getName ( ) ; // If the value corresponds to the given expected class, // then there is no need to resolve anything from the // IoC service container. if ( $ value instanceof $ className ) { return $ value ; } $ container = $ this -> container ( ) ; // Fail if no service container is available if ( is_null ( $ container ) ) { $ message = sprintf ( 'No IoC service container is available, cannot resolve property "%s" of the type "%s"; do not know how to populate with "%s"' , $ parameter -> getName ( ) , $ className , var_export ( $ value , true ) ) ; throw new BindingResolutionException ( $ message ) ; } // Get the resolved instance for the IoC container $ instance = $ container -> make ( $ className ) ; // From Laravel 5.4, the Container::make method no longer accepts // parameters, which is really sad... Nevertheless, we attempt to // resolve this, simply by checking if the instance can be // populated with the given value, which is exactly what the // `resolveInstancePopulation` method does. return $ this -> resolveInstancePopulation ( $ instance , $ parameter , $ value ) ; }
Resolve the given parameter; pass the given value to it

@param ReflectionParameter $parameter The setter method's parameter reflection
@param mixed $value The value to be passed to the setter method

@return mixed
@throws BindingResolutionException   a) If no concrete instance could be resolved from the IoC, or
b) If the instance is not populatable and or the given value is not an
array that can be passed to the populatable instance
c) No service container is available
Resolve the given parameter ; pass the given value to it