Library/Types/AbstractType.php
public function invokeMethod(
        $methodName,
        $caller,
        CompilationContext
        $compilationContext,
        Call $call,
        array $expression
    ) {
        /*
         * Checks first whether the method exist in the array type definition
         */
        if (method_exists($this, $methodName)) {
            return $this->{$methodName}($caller, $compilationContext, $call, $expression);
        }

        /*
         * Check the method map
         */
        if (isset($this->methodMap[$methodName])) {
            $paramNumber = $this->getNumberParam($methodName);
            if (0 == $paramNumber) {
                if (isset($expression['parameters'])) {
                    $parameters = $expression['parameters'];
                    array_unshift($parameters, ['parameter' => $caller]);
                } else {
                    $parameters = [['parameter' => $caller]];
                }
            } else {
                if (isset($expression['parameters'])) {
                    $parameters = [];
                    foreach ($expression['parameters'] as $number => $parameter) {
                        if ($number == $paramNumber) {
                            $parameters[] = null;
                        }
                        $parameters[] = $parameter;
                    }
                    $parameters[$paramNumber] = ['parameter' => $caller];
                } else {
                    $parameters = [['parameter' => $caller]];
                }
            }

            $functionCall = BuilderFactory::getInstance()->statements()
                ->functionCall($this->methodMap[$methodName], $parameters)
                ->setFile($expression['file'])
                ->setLine($expression['line'])
                ->setChar($expression['char']);

            $expression = new Expression($functionCall->build());

            return $expression->compile($compilationContext);
        }

        throw new CompilerException(
            sprintf('Method "%s" is not a built-in method of type "%s"', $methodName, $this->getTypeName()),
            $expression
        );
    }
public function invokeMethod(
        $methodName,
        $caller,
        CompilationContext
        $compilationContext,
        Call $call,
        array $expression
    ) {
        /*
         * Checks first whether the method exist in the array type definition
         */
        if (method_exists($this, $methodName)) {
            return $this->{$methodName}($caller, $compilationContext, $call, $expression);
        }

        /*
         * Check the method map
         */
        if (isset($this->methodMap[$methodName])) {
            $paramNumber = $this->getNumberParam($methodName);
            if (0 == $paramNumber) {
                if (isset($expression['parameters'])) {
                    $parameters = $expression['parameters'];
                    array_unshift($parameters, ['parameter' => $caller]);
                } else {
                    $parameters = [['parameter' => $caller]];
                }
            } else {
                if (isset($expression['parameters'])) {
                    $parameters = [];
                    foreach ($expression['parameters'] as $number => $parameter) {
                        if ($number == $paramNumber) {
                            $parameters[] = null;
                        }
                        $parameters[] = $parameter;
                    }
                    $parameters[$paramNumber] = ['parameter' => $caller];
                } else {
                    $parameters = [['parameter' => $caller]];
                }
            }

            $functionCall = BuilderFactory::getInstance()->statements()
                ->functionCall($this->methodMap[$methodName], $parameters)
                ->setFile($expression['file'])
                ->setLine($expression['line'])
                ->setChar($expression['char']);

            $expression = new Expression($functionCall->build());

            return $expression->compile($compilationContext);
        }

        throw new CompilerException(
            sprintf('Method "%s" is not a built-in method of type "%s"', $methodName, $this->getTypeName()),
            $expression
        );
    }
public function invokeMethod ( $ methodName , $ caller , CompilationContext $ compilationContext , Call $ call , array $ expression ) { /*
         * Checks first whether the method exist in the array type definition
         */ if ( method_exists ( $ this , $ methodName ) ) { return $ this -> { $ methodName } ( $ caller , $ compilationContext , $ call , $ expression ) ; } /*
         * Check the method map
         */ if ( isset ( $ this -> methodMap [ $ methodName ] ) ) { $ paramNumber = $ this -> getNumberParam ( $ methodName ) ; if ( 0 == $ paramNumber ) { if ( isset ( $ expression [ 'parameters' ] ) ) { $ parameters = $ expression [ 'parameters' ] ; array_unshift ( $ parameters , [ 'parameter' => $ caller ] ) ; } else { $ parameters = [ [ 'parameter' => $ caller ] ] ; } } else { if ( isset ( $ expression [ 'parameters' ] ) ) { $ parameters = [ ] ; foreach ( $ expression [ 'parameters' ] as $ number => $ parameter ) { if ( $ number == $ paramNumber ) { $ parameters [ ] = null ; } $ parameters [ ] = $ parameter ; } $ parameters [ $ paramNumber ] = [ 'parameter' => $ caller ] ; } else { $ parameters = [ [ 'parameter' => $ caller ] ] ; } } $ functionCall = BuilderFactory :: getInstance ( ) -> statements ( ) -> functionCall ( $ this -> methodMap [ $ methodName ] , $ parameters ) -> setFile ( $ expression [ 'file' ] ) -> setLine ( $ expression [ 'line' ] ) -> setChar ( $ expression [ 'char' ] ) ; $ expression = new Expression ( $ functionCall -> build ( ) ) ; return $ expression -> compile ( $ compilationContext ) ; } throw new CompilerException ( sprintf ( 'Method "%s" is not a built-in method of type "%s"' , $ methodName , $ this -> getTypeName ( ) ) , $ expression ) ; }
Intercepts calls to built-in methods.

@param string             $methodName
@param object             $caller
@param CompilationContext $compilationContext
@param Call               $call
@param array              $expression

@throws CompilerException

@return bool|\Zephir\CompiledExpression
Intercepts calls to built - in methods .