Library/MethodCall.php
private function getRealCalledMethod(CompilationContext $compilationContext, Variable $caller, $methodName)
    {
        $compiler = $compilationContext->compiler;

        $numberPoly = 0;
        $method = null;

        if ('this' == $caller->getRealName()) {
            $classDefinition = $compilationContext->classDefinition;
            if ($classDefinition->hasMethod($methodName)) {
                ++$numberPoly;
                $method = $classDefinition->getMethod($methodName);
            }
        } else {
            $classTypes = $caller->getClassTypes();
            foreach ($classTypes as $classType) {
                if ($compiler->isInterface($classType)) {
                    continue;
                }

                if ($compiler->isClass($classType) ||
                    $compiler->isBundledClass($classType) ||
                    $compiler->isBundledInterface($classType)
                ) {
                    if ($compiler->isClass($classType)) {
                        $classDefinition = $compiler->getClassDefinition($classType);
                    } else {
                        $classDefinition = $compiler->getInternalClassDefinition($classType);
                    }

                    if (!$classDefinition) {
                        continue;
                    }

                    if ($classDefinition->hasMethod($methodName) && !$classDefinition->isInterface()) {
                        ++$numberPoly;
                        $method = $classDefinition->getMethod($methodName);
                    }
                }
            }
        }

        return [$numberPoly, $method];
    }
private function getRealCalledMethod(CompilationContext $compilationContext, Variable $caller, $methodName)
    {
        $compiler = $compilationContext->compiler;

        $numberPoly = 0;
        $method = null;

        if ('this' == $caller->getRealName()) {
            $classDefinition = $compilationContext->classDefinition;
            if ($classDefinition->hasMethod($methodName)) {
                ++$numberPoly;
                $method = $classDefinition->getMethod($methodName);
            }
        } else {
            $classTypes = $caller->getClassTypes();
            foreach ($classTypes as $classType) {
                if ($compiler->isInterface($classType)) {
                    continue;
                }

                if ($compiler->isClass($classType) ||
                    $compiler->isBundledClass($classType) ||
                    $compiler->isBundledInterface($classType)
                ) {
                    if ($compiler->isClass($classType)) {
                        $classDefinition = $compiler->getClassDefinition($classType);
                    } else {
                        $classDefinition = $compiler->getInternalClassDefinition($classType);
                    }

                    if (!$classDefinition) {
                        continue;
                    }

                    if ($classDefinition->hasMethod($methodName) && !$classDefinition->isInterface()) {
                        ++$numberPoly;
                        $method = $classDefinition->getMethod($methodName);
                    }
                }
            }
        }

        return [$numberPoly, $method];
    }
private function getRealCalledMethod ( CompilationContext $ compilationContext , Variable $ caller , $ methodName ) { $ compiler = $ compilationContext -> compiler ; $ numberPoly = 0 ; $ method = null ; if ( 'this' == $ caller -> getRealName ( ) ) { $ classDefinition = $ compilationContext -> classDefinition ; if ( $ classDefinition -> hasMethod ( $ methodName ) ) { ++ $ numberPoly ; $ method = $ classDefinition -> getMethod ( $ methodName ) ; } } else { $ classTypes = $ caller -> getClassTypes ( ) ; foreach ( $ classTypes as $ classType ) { if ( $ compiler -> isInterface ( $ classType ) ) { continue ; } if ( $ compiler -> isClass ( $ classType ) || $ compiler -> isBundledClass ( $ classType ) || $ compiler -> isBundledInterface ( $ classType ) ) { if ( $ compiler -> isClass ( $ classType ) ) { $ classDefinition = $ compiler -> getClassDefinition ( $ classType ) ; } else { $ classDefinition = $ compiler -> getInternalClassDefinition ( $ classType ) ; } if ( ! $ classDefinition ) { continue ; } if ( $ classDefinition -> hasMethod ( $ methodName ) && ! $ classDefinition -> isInterface ( ) ) { ++ $ numberPoly ; $ method = $ classDefinition -> getMethod ( $ methodName ) ; } } } } return [ $ numberPoly , $ method ] ; }
Examine internal class information and returns the method called.

@param CompilationContext $compilationContext
@param Variable           $caller
@param string             $methodName

@return array
Examine internal class information and returns the method called .