public function getCommands() { $commands = array(); foreach (new \DirectoryIterator(__DIR__ . '/Command') as $file) { /* @var $file \SplFileObject */ list($name, $ext) = explode('.', $file->getBasename()); if ('php' !== $ext) { continue; } $refl = new ReflectionClass("Pugooroo\\Command\\{$name}"); if (!$refl->getDocComment()) { continue; } $docblock = $refl->getDocblock(); if (!$docblock->hasTag('command')) { continue; } $commands[$docblock->getTag('command')->getDescription()] = array('shortDescription' => $docblock->getShortDescription(), 'className' => $refl->getName(), 'reflection' => $refl); } return $commands; }