Phan\Language\Context::getFunctionLikeInScope PHP Method

getFunctionLikeInScope() public method

public getFunctionLikeInScope ( CodeBase $code_base ) : Phan\Language\Element\FunctionInterface
$code_base Phan\CodeBase The global code base holding all state
return Phan\Language\Element\FunctionInterface Get the method in this scope or fail real hard
    public function getFunctionLikeInScope(CodeBase $code_base) : FunctionInterface
    {
        assert($this->isInFunctionLikeScope(), "Must be in method scope to get method.");
        $fqsen = $this->getFunctionLikeFQSEN();
        if ($fqsen instanceof FullyQualifiedFunctionName) {
            assert($code_base->hasFunctionWithFQSEN($fqsen), "The function does not exist");
            return $code_base->getFunctionByFQSEN($fqsen);
        }
        if ($fqsen instanceof FullyQualifiedMethodName) {
            assert($code_base->hasMethodWithFQSEN($fqsen), "Method does not exist");
            return $code_base->getMethodByFQSEN($fqsen);
        }
        assert(false, "FQSEN must be for a function or method");
    }