/** * Register commands * * @param $commandsDir * @return bool */ protected function _registerCommands($commandsDir) { $files = FS::ls($commandsDir); if (empty($files)) { return false; } foreach ($files as $file) { require_once $file; $reflection = new \ReflectionClass(__NAMESPACE__ . '\\Command\\' . FS::filename($file)); if ($reflection->isSubclassOf('Symfony\\Component\\Console\\Command\\Command') && !$reflection->isAbstract()) { $this->add($reflection->newInstance()); } } return true; }
public function testLS() { $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'dir1'; @mkdir($dir); $file1 = $dir . DIRECTORY_SEPARATOR . 'file1'; touch($file1); is(array($file1), FS::ls($dir)); FS::rmdir($dir); }