'Console\\Command', ); public function addCommandsPath($path, $namespace) { $this->commandsPaths[$path] = trim($namespace, '\\'); return $this; } public function chdir($directory) { chdir($directory); return $this; } public function loadCommands() { foreach ($this->commandsPaths as $path => $namespace) { $finder = new Finder(); $finder->name('*Command.php')->in($path); foreach ($finder as $file) { $className = $namespace.'\\'.str_replace('.php', '', $file->getFilename()); $this->addCommands(array( new $className(), )); } } return $this; } }