/**
  * Constructs an instance of the autoload and loads the internal used mapping.
  *
  * @todo TODO: Some sort of caching would be a good idea
  */
 public function __construct()
 {
     $files = new phpucPhpFileFilterIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator(PHPUC_INSTALL_DIR)));
     foreach ($files as $file) {
         $this->classMap[$files->getClassName()] = $file->getPathname();
     }
 }
 /**
  * Registers the available phpUnderControl commands and their options.
  *
  * @return void
  */
 protected function registerCommands()
 {
     $files = new phpucPhpFileFilterIterator(new DirectoryIterator(PHPUC_INSTALL_DIR . '/Commands'));
     $commands = array();
     foreach ($files as $file) {
         // Load reflection class
         $refClass = new ReflectionClass($files->getClassName());
         // Skip abstract classes and interfaces
         if ($refClass->isInterface() || $refClass->isAbstract()) {
             continue;
         }
         // Check for extension interface
         if (!$refClass->implementsInterface('phpucConsoleCommandI')) {
             continue;
         }
         $command = $refClass->newInstance();
         $command->registerCommand($this);
         $commands[] = $command;
     }
     foreach ($commands as $command) {
         foreach ($command->createTasks() as $task) {
             if ($task instanceof phpucConsoleExtensionI) {
                 $task->registerCommandExtension($this, $command);
             }
         }
     }
     ksort($this->definition);
 }