/** * {@inheritDoc} */ public function execute(array $args = []) { $result = []; $definedFunctions = get_defined_functions(); $functionInfoFetcher = new FunctionInfoFetcher(); foreach ($definedFunctions as $group => $functions) { foreach ($functions as $functionName) { try { $function = new ReflectionFunction($functionName); } catch (\Exception $e) { continue; } $result[$function->getName()] = $functionInfoFetcher->getInfo($function); } } return ['success' => true, 'result' => $result]; }
/** * Retrieves a data structure containing information about the specified method, expanding upon * {@see getFunctionInfo} to provide additional information. * * @param ReflectionMethod $method * @param ReflectionClass|null $class * * @return array */ public function getInfo($method, ReflectionClass $class = null) { if (!$method instanceof ReflectionMethod) { throw new \InvalidArgumentException("The passed argument is not of the correct type!"); } $data = array_merge(parent::getInfo($method), ['override' => $this->getOverrideInfo($method), 'implementation' => $this->getImplementationInfo($method), 'isMagic' => false, 'isPublic' => $method->isPublic(), 'isProtected' => $method->isProtected(), 'isPrivate' => $method->isPrivate(), 'isStatic' => $method->isStatic(), 'declaringClass' => $this->getDeclaringClass($method), 'declaringStructure' => $this->getDeclaringStructure($method)]); // Determine this again as members can return types such as 'static', which requires the declaring class, which // was not available yet before. $data['return']['resolvedType'] = $this->determineFullReturnType($data, $class->name); return $data; }