Gets list of functions in the namespace

@return ReflectionFunction[]|array
551254
public function getFunctions()
    {
        if (!isset($this->fileFunctions)) {
            $this->fileFunctions = $this->findFunctions();
        }

        return $this->fileFunctions;
    }
1232083
public function getNamespace()
    {
        if (null === $this->reflected) {
            $this->reflected = new \ReflectionObject($this);
        }

        return $this->reflected->getNamespaceName();
    }
583636
private function getMethods(): array
    {
        $tests = [];
        $methods = $this->refl->getMethods(\ReflectionMethod::IS_PUBLIC);
        foreach ($methods as $method) {
            $hasTestName = preg_match(self::$testName, $method->getName());
            $docComment = $method->getDocComment();
            $hasTestAnnotation = false !== $docComment && preg_match(self::$testAnnotation, $docComment);
            $isTestMethod = $hasTestName || $hasTestAnnotation;
            if ($isTestMethod) {
                $tests[] = new ParsedFunction((string) $method->getDocComment(), 'public', $method->getName());
            }
        }

        return $tests;
    }
189040
private function findClasses()
    {
        $classes       = array();
        $namespaceName = $this->getName();
        // classes can be only top-level nodes in the namespace, so we can scan them directly
        foreach ($this->namespaceNode->stmts as $namespaceLevelNode) {
            if ($namespaceLevelNode instanceof ClassLike) {
                $classShortName = $namespaceLevelNode->name->toString();
                $className = $namespaceName ? $namespaceName .'\\' . $classShortName : $classShortName;

                $namespaceLevelNode->setAttribute('fileName', $this->fileName);
                $classes[$className] = new ReflectionClass($className, $namespaceLevelNode);
            }
        }

        return $classes;
    }
946515
final protected function method():array{
    $arr = [];
    foreach((new \ReflectionClass($this))->getMethods(\ReflectionMethod::IS_PUBLIC) as $m){
      if(strpos($m->name,'__')!==0)
        if($m->class===self::class){
          if(ctype_upper($m->name))
            $arr[$m->name] = $m;
        }
        elseif(ctype_print($m->name))
          $arr[strtoupper($m->name)] = $m;
    }
    return $arr;
  }
648446
public function getFunctions()
    {
        return [
            /**
             * Theme functions
             */
            new \Twig_Function('body_class', function ($class = '') {
                return body_class($class);
            }),
            new \Twig_Function('post_class', function ($class = '', $post_id = null) {
                return post_class($class, $post_id);
            }),
            new \Twig_Function('wp_head', 'wp_head'),
            new \Twig_Function('wp_footer', 'wp_footer'),

            /**
             * Helper functions
             */
            new \Twig_Function('fn', function ($name) {
                $args = func_get_args();

                // By default, the function signature should be the first argument.
                // Let's remove it from the list of arguments.
                array_shift($args);

                return call_user_func_array(trim($name), $args);
            }),
            new \Twig_Function('meta', function ($object_id, $meta_key = '', $single = false, $meta_type = 'post') {
                return meta($object_id, $meta_key, $single, $meta_type);
            }),

            /**
             * Translations functions
             */
            new \Twig_Function('__', function ($text, $domain = 'default') {
                return __($text, $domain);
            }),
            new \Twig_Function('_e', function ($text, $domain = 'default') {
                return _e($text, $domain);
            }),
            new \Twig_Function('_ex', function ($text, $context, $domain = 'default') {
                return _ex($text, $context, $domain);
            }),
            new \Twig_Function('_n', function ($singular, $plural, $number, $domain = 'default') {
                return _n($singular, $plural, $number, $domain);
            }),
            new \Twig_Function('_n_noop', function ($singular, $plural, $domain = 'default') {
                return _n_noop($singular, $plural, $domain);
            }),
            new \Twig_Function('_nx', function ($singular, $plural, $number, $context, $domain = 'default') {
                return _nx($singular, $plural, $number, $context, $domain);
            }),
            new \Twig_Function('_nx_noop', function ($singular, $plural, $context, $domain = 'default') {
                return _nx_noop($singular, $plural, $context, $domain);
            }),
            new \Twig_Function('_x', function ($text, $context, $domain = 'default') {
                return _x($text, $context, $domain);
            }),
            new \Twig_Function('translate', function ($text, $domain = 'default') {
                return translate($text, $domain);
            }),
            new \Twig_Function('translate_nooped_plural', function ($plural, $count, $domain = 'default') {
                return translate_nooped_plural($plural, $count, $domain);
            })
        ];
    }
766662
public function getFunctions()
    {
        return [
            new \Twig_SimpleFunction('isEager', function($stuff) {
                return AgnosticFetchHelper::isEager($stuff);
            }),
            new \Twig_SimpleFunction('all', function($stuff) {
                return AgnosticFetchHelper::all($stuff);
            }),
            new \Twig_SimpleFunction('one', function($stuff) {
                return AgnosticFetchHelper::one($stuff);
            }),
            new \Twig_SimpleFunction('nth', function($stuff, $n) {
                return AgnosticFetchHelper::nth($stuff, $n);
            }),
            new \Twig_SimpleFunction('ids', function($stuff) {
                return AgnosticFetchHelper::ids($stuff);
            }),
            new \Twig_SimpleFunction('count', function($stuff) {
                return AgnosticFetchHelper::count($stuff);
            }),
        ];
    }
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;
    }
497298
public function getFunctions()
    {
        return [
            new ExpressionFunction('elcodi_config', function ($name, $defaultValue = null) {

                return ($defaultValue)
                    ? sprintf(
                        '$this->get(\'elcodi.manager.configuration\')->get(%s,%s)',
                        $name,
                        $defaultValue
                    )
                    : sprintf(
                        '$this->get(\'elcodi.manager.configuration\')->get(%s)',
                        $name
                    );

            }, function (array $variables, $name, $defaultValue = null) {
                return $variables['container']
                    ->get('elcodi.manager.configuration')
                    ->get($name, $defaultValue);
            }),
        ];
    }
448824
private function getClassPublicMethods(): array
    {
        return \array_filter(\array_map(
            function (\ReflectionMethod $method): string {
                return !$method->isStatic() ? $method->getName() : '';
            },
            (new \ReflectionObject($this))->getMethods(\ReflectionMethod::IS_PUBLIC)
        ));
    }
1195938
public function getMethods()
    {
        $aMethods = [];
        foreach($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod)
        {
            $sMethodName = $xMethod->getShortName();
            // Don't take magic __call, __construct, __destruct methods
            if(strlen($sMethodName) > 2 && substr($sMethodName, 0, 2) == '__')
            {
                continue;
            }
            // Don't take excluded methods
            if(in_array($sMethodName, $this->aProtectedMethods))
            {
                continue;
            }
            $aMethods[] = $sMethodName;
        }
        return $aMethods;
    }
637958
public static function fromReflection(ReflectionFunction $reflectionFunction)
    {
        $name = self::extractShortNameFromFullyQualifiedName($reflectionFunction->getName());
        $namespace = self::extractNamespaceFromQualifiedName($reflectionFunction->getName());

        $function = new static($name, trim($reflectionFunction->getBody()));
        $function->setNamespace($namespace);
        foreach ($reflectionFunction->getParameters() as $parameter) {
            $function->addParameter(ParameterGenerator::fromReflection($parameter));
        }

        if ($reflectionFunction->getReflectionDocComment()->isEmpty() !== true) {
            $function->setDocumentation(
                DocCommentGenerator::fromReflection($reflectionFunction->getReflectionDocComment())
            );
        }

        return $function;
    }
250344
public function getFunctions()
    {
        return array_merge(parent::getFunctions(), [
            new \Twig_SimpleFunction('getThemes', [$this, 'getThemes']),
            new \Twig_SimpleFunction('uniqueKey', [$this, 'uniqueKey']),
            new \Twig_SimpleFunction('getAlert', [$this, 'getAlert'], ['needs_context' => true]),
            new \Twig_SimpleFunction('getSettingOptions', [$this, 'getSettingOptions']),
            new \Twig_SimpleFunction('getCollections', [$this, 'getCollections']),
            new \Twig_SimpleFunction('getGalleries', [$this, 'getGalleries']),
            new \Twig_SimpleFunction('getElements', [$this, 'getElements']),
            new \Twig_SimpleFunction('getUnreadMessageCount', [$this, 'getUnreadMessageCount']),
        ]);
    }
457087
public function getOperations()
    {
        $functions = array();
        foreach ($this->soapClient->__getFunctions() as $functionString) {
            $function = new OperationNode($functionString);
            $functionNodes = $this->xpath('//wsdl:operation[@name=%s]', $function->getName());
            if ($functionNodes->length > 0) {
                $function->setElement($this->document, $functionNodes->item(0));
                $functions[] = $function;
            }
        }
        return $functions;
    }
296117
public function getNamespaces() {
        $namespaces = [];
        foreach ($this->commands as $command) {
            $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));

            foreach ($command->getAliases() as $alias) {
                $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
            }
        }

        return array_values(array_unique(array_filter($namespaces)));
    }
68504
public function getClassAndMethodNamesForCalling(): array
    {
        $domain = $this->consoleInput->getDomainName();
        $action = $this->consoleInput->getActionName();

        $className = self::getFQDNClass($domain);

        return [$className, $domain, $action];
    }
279702
public function getFunctions()
    {
        return array(
            new Twig_SimpleFunction('max', 'max'),
            new Twig_SimpleFunction('min', 'min'),
            new Twig_SimpleFunction('range', 'range'),
            new Twig_SimpleFunction('constant', 'twig_constant'),
            new Twig_SimpleFunction('cycle', 'twig_cycle'),
            new Twig_SimpleFunction('random', 'twig_random', array('needs_environment' => true)),
            new Twig_SimpleFunction('date', 'twig_date_converter', array('needs_environment' => true)),
            new Twig_SimpleFunction('include', 'twig_include', array('needs_environment' => true, 'needs_context' => true, 'is_safe' => array('all'))),
            new Twig_SimpleFunction('source', 'twig_source', array('needs_environment' => true, 'is_safe' => array('all'))),
        );
    }