diff --git a/core/app/Console/Kernel.php b/core/app/Console/Kernel.php index 0b2bb34..2bbcae6 100644 --- a/core/app/Console/Kernel.php +++ b/core/app/Console/Kernel.php @@ -8,23 +8,65 @@ use Laravel\Lumen\Console\Kernel as ConsoleKernel; class Kernel extends ConsoleKernel { - /** - * The Artisan commands provided by your application. - * - * @var array - */ - protected $commands = [ - HelloWorld::class - ]; - /** * Define the application's command schedule. * - * @param \Illuminate\Console\Scheduling\Schedule $schedule + * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void */ protected function schedule(Schedule $schedule) { // } + + private function extractClass($file) + { + $fp = fopen($file, 'r'); + $class = $namespace = $buffer = ''; + $i = 0; + while (!$class) { + if (feof($fp)) break; + + $buffer .= fread($fp, 512); + $tokens = token_get_all($buffer); + + if (strpos($buffer, '{') === false) continue; + + for (;$iextractClass($commands_path . '/' . $file); + } + + $commands = parent::getCommands(); + return array_merge($commands, $classes); + } }