lithium\console\command\Help::_methods PHP Метод

_methods() защищенный Метод

Get the methods for the class.
protected _methods ( string $class, array $options = [] ) : array
$class string
$options array
Результат array
    protected function _methods($class, $options = array())
    {
        $defaults = array('name' => null);
        $options += $defaults;
        $map = function ($item) {
            if ($item->name[0] === '_') {
                return;
            }
            $modifiers = array_values(Inspector::invokeMethod('_modifiers', array($item)));
            $setAccess = array_intersect($modifiers, array('private', 'protected')) != array();
            if ($setAccess) {
                $item->setAccessible(true);
            }
            $args = array();
            foreach ($item->getParameters() as $arg) {
                $args[] = array('name' => $arg->getName(), 'optional' => $arg->isOptional(), 'description' => null);
            }
            $result = compact('modifiers', 'args') + array('docComment' => $item->getDocComment(), 'name' => $item->getName());
            if ($setAccess) {
                $item->setAccessible(false);
            }
            return $result;
        };
        $methods = Inspector::methods($class)->map($map, array('collect' => false));
        $results = array();
        foreach (array_filter($methods) as $method) {
            $comment = Docblock::comment($method['docComment']);
            $name = $method['name'];
            $description = trim($comment['description'] . PHP_EOL . $comment['text']);
            $args = $method['args'];
            $return = null;
            foreach ($args as &$arg) {
                if (isset($comment['tags']['params']['$' . $arg['name']])) {
                    $arg['description'] = $comment['tags']['params']['$' . $arg['name']]['text'];
                }
                $arg['usage'] = $arg['optional'] ? "[<{$arg['name']}>]" : "<{$arg['name']}>";
            }
            if (isset($comment['tags']['return'])) {
                $return = trim(strtok($comment['tags']['return'], ' '));
            }
            $results[$name] = compact('name', 'description', 'return', 'args');
            if ($name && $name == $options['name']) {
                return array($name => $results[$name]);
            }
        }
        return $results;
    }