Library/ClassMethod.php
public function setupOptimized(CompilationContext $compilationContext)
    {
        if (!$compilationContext->config->get('internal-call-transformation', 'optimizations')) {
            return $this;
        }
        $classDefinition = $this->getClassDefinition();
        /* Skip for closures */
        if ('__invoke' == $this->getName() || $classDefinition->isInterface()) {
            return $this;
        }
        if (!$this->isInternal() && !$classDefinition->isBundled()) {
            /* Not supported for now */
            if ($this->getNumberOfRequiredParameters() != $this->getNumberOfParameters()) {
                return $this;
            }
            if ($this->isConstructor()) {
                return $this;
            }
            $optimizedName = $this->getName().'_zephir_internal_call';

            $visibility = ['internal'];

            $statements = null;
            if ($this->statements) {
                $statements = new StatementsBlock(json_decode(json_encode($this->statements->getStatements()), true));
            }

            $optimizedMethod = new self(
                $classDefinition,
                $visibility,
                $optimizedName,
                $this->parameters,
                $statements,
                $this->docblock,
                null,
                $this->expression
            );
            $optimizedMethod->typeInference = $this->typeInference;
            $optimizedMethod->setReturnTypes($this->returnTypes);
            $classDefinition->addMethod($optimizedMethod);
        }

        return $this;
    }
public function setupOptimized(CompilationContext $compilationContext)
    {
        if (!$compilationContext->config->get('internal-call-transformation', 'optimizations')) {
            return $this;
        }
        $classDefinition = $this->getClassDefinition();
        /* Skip for closures */
        if ('__invoke' == $this->getName() || $classDefinition->isInterface()) {
            return $this;
        }
        if (!$this->isInternal() && !$classDefinition->isBundled()) {
            /* Not supported for now */
            if ($this->getNumberOfRequiredParameters() != $this->getNumberOfParameters()) {
                return $this;
            }
            if ($this->isConstructor()) {
                return $this;
            }
            $optimizedName = $this->getName().'_zephir_internal_call';

            $visibility = ['internal'];

            $statements = null;
            if ($this->statements) {
                $statements = new StatementsBlock(json_decode(json_encode($this->statements->getStatements()), true));
            }

            $optimizedMethod = new self(
                $classDefinition,
                $visibility,
                $optimizedName,
                $this->parameters,
                $statements,
                $this->docblock,
                null,
                $this->expression
            );
            $optimizedMethod->typeInference = $this->typeInference;
            $optimizedMethod->setReturnTypes($this->returnTypes);
            $classDefinition->addMethod($optimizedMethod);
        }

        return $this;
    }
public function setupOptimized ( CompilationContext $ compilationContext ) { if ( ! $ compilationContext -> config -> get ( 'internal-call-transformation' , 'optimizations' ) ) { return $ this ; } $ classDefinition = $ this -> getClassDefinition ( ) ; /* Skip for closures */ if ( '__invoke' == $ this -> getName ( ) || $ classDefinition -> isInterface ( ) ) { return $ this ; } if ( ! $ this -> isInternal ( ) && ! $ classDefinition -> isBundled ( ) ) { /* Not supported for now */ if ( $ this -> getNumberOfRequiredParameters ( ) != $ this -> getNumberOfParameters ( ) ) { return $ this ; } if ( $ this -> isConstructor ( ) ) { return $ this ; } $ optimizedName = $ this -> getName ( ) . '_zephir_internal_call' ; $ visibility = [ 'internal' ] ; $ statements = null ; if ( $ this -> statements ) { $ statements = new StatementsBlock ( json_decode ( json_encode ( $ this -> statements -> getStatements ( ) ) , true ) ) ; } $ optimizedMethod = new self ( $ classDefinition , $ visibility , $ optimizedName , $ this -> parameters , $ statements , $ this -> docblock , null , $ this -> expression ) ; $ optimizedMethod -> typeInference = $ this -> typeInference ; $ optimizedMethod -> setReturnTypes ( $ this -> returnTypes ) ; $ classDefinition -> addMethod ( $ optimizedMethod ) ; } return $ this ; }
Generate internal method's based on the equivalent PHP methods,
allowing bypassing php userspace for internal method calls.

@param CompilationContext $compilationContext

@return $this
Generate internal method s based on the equivalent PHP methods allowing bypassing php userspace for internal method calls .