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 * Class Enumerator class.
19 class ClassEnumerator extends Enumerator
24 protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null)
26 // only list classes when no Reflector is present.
28 // @todo make a NamespaceReflector and pass that in for commands like:
32 // ... for listing classes in the Foo namespace
34 if ($reflector !== null || $target !== null) {
38 // only list classes if we are specifically asked
39 if (!$input->getOption('classes')) {
43 $classes = $this->prepareClasses(get_declared_classes());
45 if (empty($classes)) {
50 'Classes' => $classes,
55 * Prepare formatted class array.
61 protected function prepareClasses(array $classes)
63 natcasesort($classes);
65 // My kingdom for a generator.
68 foreach ($classes as $name) {
69 if ($this->showItem($name)) {
72 'style' => self::IS_CLASS,
73 'value' => $this->presentSignature($name),