private function getProviderCode(DependencyProvider $provider) : Code
    {
        $prop = $this->privateProperty;
        $dependency = $prop($provider, 'dependency');
        $node = $this->getFactoryNode($dependency);
        $provider->setContext($this);
        if ($this->context) {
            $node[] = $this->getSetContextCode($this->context); // $instance->setContext($this->context);
        }
        $isSingleton = $prop($provider, 'isSingleton');
        $node[] = $this->getIsSingletonCode($isSingleton);
        $node[] = new Stmt\Return_(new MethodCall(new Expr\Variable('instance'), 'get'));
        $node = $this->factory->namespace('Ray\Di\Compiler')->addStmts($node)->getNode();
        $qualifer = $this->qualifier;
        $this->qualifier = null;

        return new Code($node, $isSingleton, $qualifer);
    }
private function getProviderCode(DependencyProvider $provider) : Code
    {
        $prop = $this->privateProperty;
        $dependency = $prop($provider, 'dependency');
        $node = $this->getFactoryNode($dependency);
        $provider->setContext($this);
        if ($this->context) {
            $node[] = $this->getSetContextCode($this->context); // $instance->setContext($this->context);
        }
        $isSingleton = $prop($provider, 'isSingleton');
        $node[] = $this->getIsSingletonCode($isSingleton);
        $node[] = new Stmt\Return_(new MethodCall(new Expr\Variable('instance'), 'get'));
        $node = $this->factory->namespace('Ray\Di\Compiler')->addStmts($node)->getNode();
        $qualifer = $this->qualifier;
        $this->qualifier = null;

        return new Code($node, $isSingleton, $qualifer);
    }
private function getProviderCode ( DependencyProvider $ provider ) : Code { $ prop = $ this -> privateProperty ; $ dependency = $ prop ( $ provider , 'dependency' ) ; $ node = $ this -> getFactoryNode ( $ dependency ) ; $ provider -> setContext ( $ this ) ; if ( $ this -> context ) { $ node [ ] = $ this -> getSetContextCode ( $ this -> context ) ; // $instance->setContext($this->context); } $ isSingleton = $ prop ( $ provider , 'isSingleton' ) ; $ node [ ] = $ this -> getIsSingletonCode ( $ isSingleton ) ; $ node [ ] = new Stmt \ Return_ ( new MethodCall ( new Expr \ Variable ( 'instance' ) , 'get' ) ) ; $ node = $ this -> factory -> namespace ( 'Ray\Di\Compiler' ) -> addStmts ( $ node ) -> getNode ( ) ; $ qualifer = $ this -> qualifier ; $ this -> qualifier = null ; return new Code ( $ node , $ isSingleton , $ qualifer ) ; }
Compile dependency provider
Compile dependency provider