4 * This file is part of Psy Shell.
6 * (c) 2012-2017 Justin Hileman
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Psy\Command\ListCommand;
14 use Symfony\Component\Console\Input\InputInterface;
17 * Interface Enumerator class.
19 class InterfaceEnumerator extends Enumerator
24 protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null)
26 // only list interfaces when no Reflector is present.
28 // @todo make a NamespaceReflector and pass that in for commands like:
30 // ls --interfaces Foo
32 // ... for listing interfaces in the Foo namespace
34 if ($reflector !== null || $target !== null) {
38 // only list interfaces if we are specifically asked
39 if (!$input->getOption('interfaces')) {
43 $interfaces = $this->prepareInterfaces(get_declared_interfaces());
45 if (empty($interfaces)) {
50 'Interfaces' => $interfaces,
55 * Prepare formatted interface array.
57 * @param array $interfaces
61 protected function prepareInterfaces(array $interfaces)
63 natcasesort($interfaces);
65 // My kingdom for a generator.
68 foreach ($interfaces as $name) {
69 if ($this->showItem($name)) {
72 'style' => self::IS_CLASS,
73 'value' => $this->presentSignature($name),