@param string $className
@param string $functionName

@return ReflectionFunctionAbstract
540281
private function buildReflectionFunction($className, $functionName)
    {
        return (empty($className))
            ? new ReflectionFunction($this->getFullFunctionName($className, $functionName))
            : new ReflectionMethod($className, $functionName);
    }
47478
public function newInstance($className, array $args = array())
    {
        // create and return a new instance
        $reflectionClass = $this->newReflectionClass($className);
        return $reflectionClass->newInstanceArgs($args);
    }
5831
public function createNew($className)
    {
        $constructArguments = func_get_args();
        $object = $this->_createNew( ...$constructArguments);
        
        $traits = class_uses($object);

        if (isset($traits[Framework::class]) == true) {
            $object->setContainer($this->container);
        }

        return $object;
    }
844283
public function hasMethod($className, $methodName)
    {
        try {
            if (!array_key_exists($className, $this->classMethodNames) || !array_key_exists($methodName, $this->classMethodNames[$className])) {
                $this->getMethodReflection($className, $methodName);
                $this->classMethodNames[$className][$methodName] = true;
            }
        } catch (\ReflectionException $e) {
            // Method does not exist. Store this information in cache.
            $this->classMethodNames[$className][$methodName] = null;
        }
        return isset($this->classMethodNames[$className][$methodName]);
    }
628750
protected function getMethodInstance(&$object, $methodName)
    {
        $method = new ReflectionMethod(get_class($object), $methodName);
        $method->setAccessible(true);

        return $method;
    }
325279
public Define getFunction(String functionName) {
		Define func = functionMap.get(functionName);
		return func != null ? func : engineConfig.getSharedFunction(functionName);
	}
183959
public function callFunction($functionName, $parameters)
    {
        $parameters = is_array($parameters) ? $parameters : array();
        $response = call_user_func_array(array($this->getObject(), $functionName), $parameters);

        return $response;
    }
315899
public function injector($classname, $method = null)
    {
        $params = [];
        $reflection = new \ReflectionClass($classname);

        if (is_null($method)) {
            $method = "__invoke";
        }

        $parameters = $reflection->getMethod($method)->getParameters();

        foreach ($parameters as $parameter) {
            $class = $parameter->getClass();

            if (is_null($class)) {
                continue;
            }

            $constructor = $class->getName();

            if (! class_exists($constructor, true)) {
                continue;
            }

            if (!in_array(strtolower($constructor), $this->getInjectorExceptedType())) {
                if (method_exists($constructor, 'getInstance')) {
                    $params[] = $constructor::getInstance();
                } else {
                    $params[] = new $constructor();
                }
            }
        }

        return $params;
    }
674015
public function getReflector($funcName)
    {
        /*
         * Check if the optimizer is already cached
         */
        if (!isset(self::$functionReflection[$funcName])) {
            try {
                $reflectionFunction = new \ReflectionFunction($funcName);
            } catch (\ReflectionException $e) {
                $reflectionFunction = null;
            }
            self::$functionReflection[$funcName] = $reflectionFunction;
            $this->reflection = $reflectionFunction;

            return $reflectionFunction;
        }
        $reflectionFunction = self::$functionReflection[$funcName];
        $this->reflection = $reflectionFunction;

        return $reflectionFunction;
    }
242671
public function buildFunction($functionName)
    {
        trigger_error(__CLASS__.' is no longer supported and will be removed in version 2', \E_USER_DEPRECATED);
        $function = $this->makeFunction();
        $whitespace = $this->makeWhitespace(null);
        $string = $this->makeString($functionName);

        return array($function, $whitespace, $string);
    }
1051485
private function parseMethodWithoutAnnotation(string $className, string $methodName)
    {
        $parser = new MethodWithoutAnnotationParser($this->annotationResource);
        $parser->parser($className, null, "", $methodName);
    }
175365
public function functionExists($functionName, CompilationContext $context)
    {
        if (\function_exists($functionName)) {
            return true;
        }
        if ($this->isBuiltInFunction($functionName)) {
            return true;
        }

        $internalName = ['f__'.$functionName];
        if (isset($context->classDefinition)) {
            $lowerNamespace = strtolower($context->classDefinition->getNamespace());
            $prefix = 'f_'.str_replace('\\', '_', $lowerNamespace);

            $internalName[] = $prefix.'_'.$functionName;
        }

        foreach ($internalName as $name) {
            if (isset($context->compiler->functionDefinitions[$name])) {
                return true;
            }
        }

        return false;
    }
900696
private static function createInstance($classname, array $arguments = array())
    {
        $reflection_obj = new ReflectionClass($classname);
        if ($reflection_obj->getMethod('__construct')->isPublic()) {
            self::$_instances[ $classname ] = call_user_func_array(array($reflection_obj, 'newInstance'), $arguments);
            if (
                method_exists(self::$_instances[ $classname ], 'init') &&
                is_callable(array(self::$_instances[ $classname ], 'init'))
            ) {
                self::$_instances[ $classname ]->init();
            }
        } else {
            self::$_instances[ $classname ] = new $classname;
            if (
                method_exists(self::$_instances[ $classname ], 'init') &&
                is_callable(array(self::$_instances[ $classname ], 'init'))
            ) {
                call_user_func_array(array(self::$_instances[ $classname ], 'init'), $arguments);
            }
        }
    }
522674
protected static function _getFunction($functionName)
    {
        if (is_string($functionName) && !function_exists($functionName)) {
            return false;

        } elseif (empty($functionName)) {

            return false;
        }

        // create ReflectionFunction instance
        $func = new ReflectionFunction($functionName);

        // get basic function info
        $result         = array();
        $result['name'] = $func->getName();
        $result['type'] = $func->isInternal() ? 'internal' : 'user-defined';

        if (method_exists($func, 'getNamespaceName') && $namespace = $func->getNamespaceName()) {
            $result['namespace'] = $namespace;
        }
        if ($func->isDeprecated()) {
            $result['deprecated'] = true;
        }
        if ($static = $func->getStaticVariables()) {
            $result['static'] = $static;
        }
        if ($reference = $func->returnsReference()) {
            $result['reference'] = $reference;
        }
        if ($path = $func->getFileName()) {
            $result['path'] = $path . ' ' . $func->getStartLine() . '/' . $func->getEndLine();
        }
        if ($parameters = $func->getParameters()) {
            $result['parameters'] = self::_getParams($parameters, $func->isInternal());
        }

        // get function source
        if (isset($result['path']) && $result['path']) {
            $result['comment'] = $func->getDocComment();

            $startLine = $func->getStartLine();
            $endLine   = $func->getEndLine();
            $source    = @file($func->getFileName());

            if ($startLine && $source) {

                $from  = (int)($startLine - 1);
                $to    = (int)($endLine - $startLine + 1);
                $slice = array_slice($source, $from, $to);

                $result['source::source'] = implode('', $slice);

            }
        }

        return $result;
    }
1348965
private function getNamedArguments($className, $functionName, array $arguments)
    {
        $fullFunctionName = $this->getFullFunctionName($className, $functionName);

        if (empty($this->functionArgumentsCache[$fullFunctionName])) {
            $this->functionArgumentsCache[$fullFunctionName] =
                $this->buildReflectionFunction($className, $functionName)->getParameters();
        }

        $i              = 0;
        $namedArguments = array();
        foreach ($this->functionArgumentsCache[$fullFunctionName] as $parameter) {
            /** @var ReflectionParameter $parameter */
            try {
                $defaultValue = '[defaultValue:' . $this->sanitize($parameter->getDefaultValue()) . ']';
            } catch (ReflectionException $e) {
                $defaultValue = '';
            }

            $namedArguments[$parameter->getName()] = isset($arguments[$i])
                ? $arguments[$i]
                : $defaultValue;
            $i++;
        }

        return $namedArguments;
    }
975935
public function isMethodFinal($className, $methodName)
    {
        $className = $this->prepareClassReflectionForUsage($className);
        return isset($this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_FINAL]);
    }
544167
public Function getFunction(String functionName) throws NoSuchFunctionException {
        if (!members.containsKey(functionName)) {
            throw new NoSuchFunctionException("Can not find function " + functionName + " in library " + name + " (" + prefix + ")");
        }

        return members.get(functionName);
    }