/** * 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 testFilename() { isSame('image', FS::filename('image.png')); isSame('image.jpg', FS::filename('image.jpg.png')); isSame('image.jpg', FS::filename('/file/path/image.jpg.png')); isSame('image', FS::filename('image')); isSame('', FS::filename('')); isSame('', FS::filename(null)); isSame('', FS::filename(false)); }