src/Container.php
protected function generate(string $abstract, ReflectionParameter $dependency) : Closure
    {
        if ($class = $dependency->getClass()) {
            return $this->build($class->name, "{$abstract}{$class->name}");
        }

        try {
            $value = $dependency->getDefaultValue();

            return function () use ($value) {
                return $value;
            };
        } catch (ReflectionException $e) {
            throw new ContainerException("Cannot resolve '$dependency->name' of '$abstract'", 0, $e);
        }
    }
protected function generate(string $abstract, ReflectionParameter $dependency) : Closure
    {
        if ($class = $dependency->getClass()) {
            return $this->build($class->name, "{$abstract}{$class->name}");
        }

        try {
            $value = $dependency->getDefaultValue();

            return function () use ($value) {
                return $value;
            };
        } catch (ReflectionException $e) {
            throw new ContainerException("Cannot resolve '$dependency->name' of '$abstract'", 0, $e);
        }
    }
protected function generate ( string $ abstract , ReflectionParameter $ dependency ) : Closure { if ( $ class = $ dependency -> getClass ( ) ) { return $ this -> build ( $ class -> name , "{$abstract}{$class->name}" ) ; } try { $ value = $ dependency -> getDefaultValue ( ) ; return function ( ) use ( $ value ) { return $ value ; } ; } catch ( ReflectionException $ e ) { throw new ContainerException ( "Cannot resolve '$dependency->name' of '$abstract'" , 0 , $ e ) ; } }
Generate the dependencies callbacks to jump some conditions in every dependency creation.

@param string               $abstract   The class name or container element name to resolve dependencies.
@param ReflectionParameter  $dependency The class dependency to be resolved.

@throws ContainerException When a dependency cannot be solved.
@return Closure
Generate the dependencies callbacks to jump some conditions in every dependency creation .