From f5301a5af88b890540592bfcb5d3fc523f4ada69 Mon Sep 17 00:00:00 2001 From: moon0326 Date: Thu, 20 Aug 2015 11:36:07 -0700 Subject: [PATCH] Remove unnecessary illuminate classes --- .../Foundation/Console/AppNameCommand.php | 338 ------------------ .../Console/ClearCompiledCommand.php | 41 --- .../Foundation/Console/CommandMakeCommand.php | 90 ----- .../Foundation/Console/ConfigCacheCommand.php | 75 ---- .../Foundation/Console/ConfigClearCommand.php | 55 --- illuminate/Foundation/Console/DownCommand.php | 34 -- .../Foundation/Console/EnvironmentCommand.php | 32 -- .../Console/EventGenerateCommand.php | 48 --- .../Foundation/Console/EventMakeCommand.php | 50 --- .../Foundation/Console/FreshCommand.php | 74 ---- .../Console/HandlerCommandCommand.php | 84 ----- .../Console/HandlerEventCommand.php | 96 ----- .../Foundation/Console/JobMakeCommand.php | 67 ---- .../Foundation/Console/KeyGenerateCommand.php | 76 ---- .../Console/ListenerMakeCommand.php | 96 ----- .../Foundation/Console/ModelMakeCommand.php | 79 ---- .../Foundation/Console/Optimize/config.php | 202 ----------- .../Foundation/Console/OptimizeCommand.php | 129 ------- .../Console/ProviderMakeCommand.php | 50 --- illuminate/Foundation/Console/QueuedJob.php | 40 --- .../Foundation/Console/RequestMakeCommand.php | 50 --- .../Foundation/Console/RouteCacheCommand.php | 97 ----- .../Foundation/Console/RouteClearCommand.php | 55 --- .../Foundation/Console/RouteListCommand.php | 262 -------------- .../Foundation/Console/ServeCommand.php | 57 --- .../Presenters/EloquentModelPresenter.php | 68 ---- .../IlluminateApplicationPresenter.php | 71 ---- .../IlluminateCollectionPresenter.php | 42 --- .../Foundation/Console/TinkerCommand.php | 103 ------ illuminate/Foundation/Console/UpCommand.php | 34 -- .../Console/VendorPublishCommand.php | 165 --------- .../Foundation/Console/ViewClearCommand.php | 59 --- .../Console/stubs/command-handler.stub | 30 -- .../stubs/command-queued-with-handler.stub | 23 -- .../Console/stubs/command-queued.stub | 34 -- .../Console/stubs/command-with-handler.stub | 18 - .../Foundation/Console/stubs/command.stub | 29 -- .../Console/stubs/event-handler-queued.stub | 33 -- .../Console/stubs/event-handler.stub | 31 -- .../Foundation/Console/stubs/event.stub | 32 -- .../Foundation/Console/stubs/job-queued.stub | 34 -- illuminate/Foundation/Console/stubs/job.stub | 29 -- .../Console/stubs/listener-queued.stub | 33 -- .../Foundation/Console/stubs/listener.stub | 31 -- .../Foundation/Console/stubs/model.stub | 10 - .../Foundation/Console/stubs/provider.stub | 28 -- .../Foundation/Console/stubs/request.stub | 30 -- .../Foundation/Console/stubs/routes.stub | 16 - 48 files changed, 3260 deletions(-) delete mode 100644 illuminate/Foundation/Console/AppNameCommand.php delete mode 100755 illuminate/Foundation/Console/ClearCompiledCommand.php delete mode 100644 illuminate/Foundation/Console/CommandMakeCommand.php delete mode 100644 illuminate/Foundation/Console/ConfigCacheCommand.php delete mode 100644 illuminate/Foundation/Console/ConfigClearCommand.php delete mode 100755 illuminate/Foundation/Console/DownCommand.php delete mode 100755 illuminate/Foundation/Console/EnvironmentCommand.php delete mode 100644 illuminate/Foundation/Console/EventGenerateCommand.php delete mode 100644 illuminate/Foundation/Console/EventMakeCommand.php delete mode 100644 illuminate/Foundation/Console/FreshCommand.php delete mode 100644 illuminate/Foundation/Console/HandlerCommandCommand.php delete mode 100644 illuminate/Foundation/Console/HandlerEventCommand.php delete mode 100644 illuminate/Foundation/Console/JobMakeCommand.php delete mode 100755 illuminate/Foundation/Console/KeyGenerateCommand.php delete mode 100644 illuminate/Foundation/Console/ListenerMakeCommand.php delete mode 100644 illuminate/Foundation/Console/ModelMakeCommand.php delete mode 100755 illuminate/Foundation/Console/Optimize/config.php delete mode 100644 illuminate/Foundation/Console/OptimizeCommand.php delete mode 100644 illuminate/Foundation/Console/ProviderMakeCommand.php delete mode 100644 illuminate/Foundation/Console/QueuedJob.php delete mode 100644 illuminate/Foundation/Console/RequestMakeCommand.php delete mode 100644 illuminate/Foundation/Console/RouteCacheCommand.php delete mode 100644 illuminate/Foundation/Console/RouteClearCommand.php delete mode 100755 illuminate/Foundation/Console/RouteListCommand.php delete mode 100644 illuminate/Foundation/Console/ServeCommand.php delete mode 100644 illuminate/Foundation/Console/Tinker/Presenters/EloquentModelPresenter.php delete mode 100644 illuminate/Foundation/Console/Tinker/Presenters/IlluminateApplicationPresenter.php delete mode 100644 illuminate/Foundation/Console/Tinker/Presenters/IlluminateCollectionPresenter.php delete mode 100755 illuminate/Foundation/Console/TinkerCommand.php delete mode 100755 illuminate/Foundation/Console/UpCommand.php delete mode 100644 illuminate/Foundation/Console/VendorPublishCommand.php delete mode 100644 illuminate/Foundation/Console/ViewClearCommand.php delete mode 100644 illuminate/Foundation/Console/stubs/command-handler.stub delete mode 100644 illuminate/Foundation/Console/stubs/command-queued-with-handler.stub delete mode 100644 illuminate/Foundation/Console/stubs/command-queued.stub delete mode 100644 illuminate/Foundation/Console/stubs/command-with-handler.stub delete mode 100644 illuminate/Foundation/Console/stubs/command.stub delete mode 100644 illuminate/Foundation/Console/stubs/event-handler-queued.stub delete mode 100644 illuminate/Foundation/Console/stubs/event-handler.stub delete mode 100644 illuminate/Foundation/Console/stubs/event.stub delete mode 100644 illuminate/Foundation/Console/stubs/job-queued.stub delete mode 100644 illuminate/Foundation/Console/stubs/job.stub delete mode 100644 illuminate/Foundation/Console/stubs/listener-queued.stub delete mode 100644 illuminate/Foundation/Console/stubs/listener.stub delete mode 100644 illuminate/Foundation/Console/stubs/model.stub delete mode 100644 illuminate/Foundation/Console/stubs/provider.stub delete mode 100644 illuminate/Foundation/Console/stubs/request.stub delete mode 100644 illuminate/Foundation/Console/stubs/routes.stub diff --git a/illuminate/Foundation/Console/AppNameCommand.php b/illuminate/Foundation/Console/AppNameCommand.php deleted file mode 100644 index 7d2e3f0..0000000 --- a/illuminate/Foundation/Console/AppNameCommand.php +++ /dev/null @@ -1,338 +0,0 @@ -files = $files; - $this->composer = $composer; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $this->currentRoot = trim($this->laravel->getNamespace(), '\\'); - - $this->setBootstrapNamespaces(); - - $this->setAppDirectoryNamespace(); - - $this->setConfigNamespaces(); - - $this->setComposerNamespace(); - - $this->setDatabaseFactoryNamespaces(); - - $this->setPhpSpecNamespace(); - - $this->info('Application namespace set!'); - - $this->composer->dumpAutoloads(); - - $this->call('clear-compiled'); - } - - /** - * Set the namespace on the files in the app directory. - * - * @return void - */ - protected function setAppDirectoryNamespace() - { - $files = Finder::create() - ->in($this->laravel['path']) - ->name('*.php'); - - foreach ($files as $file) { - $this->replaceNamespace($file->getRealPath()); - } - } - - /** - * Replace the App namespace at the given path. - * - * @param string $path - */ - protected function replaceNamespace($path) - { - $search = [ - 'namespace '.$this->currentRoot.';', - $this->currentRoot.'\\', - ]; - - $replace = [ - 'namespace '.$this->argument('name').';', - $this->argument('name').'\\', - ]; - - $this->replaceIn($path, $search, $replace); - } - - /** - * Set the bootstrap namespaces. - * - * @return void - */ - protected function setBootstrapNamespaces() - { - $search = [ - $this->currentRoot.'\\Http', - $this->currentRoot.'\\Console', - $this->currentRoot.'\\Exceptions', - ]; - - $replace = [ - $this->argument('name').'\\Http', - $this->argument('name').'\\Console', - $this->argument('name').'\\Exceptions', - ]; - - $this->replaceIn($this->getBootstrapPath(), $search, $replace); - } - - /** - * Set the PSR-4 namespace in the Composer file. - * - * @return void - */ - protected function setComposerNamespace() - { - $this->replaceIn( - $this->getComposerPath(), $this->currentRoot.'\\\\', str_replace('\\', '\\\\', $this->argument('name')).'\\\\' - ); - } - - /** - * Set the namespace in the appropriate configuration files. - * - * @return void - */ - protected function setConfigNamespaces() - { - $this->setAppConfigNamespaces(); - - $this->setAuthConfigNamespace(); - - $this->setServicesConfigNamespace(); - } - - /** - * Set the application provider namespaces. - * - * @return void - */ - protected function setAppConfigNamespaces() - { - $search = [ - $this->currentRoot.'\\Providers', - $this->currentRoot.'\\Http\\Controllers\\', - ]; - - $replace = [ - $this->argument('name').'\\Providers', - $this->argument('name').'\\Http\\Controllers\\', - ]; - - $this->replaceIn($this->getConfigPath('app'), $search, $replace); - } - - /** - * Set the authentication User namespace. - * - * @return void - */ - protected function setAuthConfigNamespace() - { - $this->replaceIn( - $this->getAuthConfigPath(), $this->currentRoot.'\\User', $this->argument('name').'\\User' - ); - } - - /** - * Set the services User namespace. - * - * @return void - */ - protected function setServicesConfigNamespace() - { - $this->replaceIn( - $this->getServicesConfigPath(), $this->currentRoot.'\\User', $this->argument('name').'\\User' - ); - } - - /** - * Set the PHPSpec configuration namespace. - * - * @return void - */ - protected function setPhpSpecNamespace() - { - if ($this->files->exists($path = $this->getPhpSpecConfigPath())) { - $this->replaceIn($path, $this->currentRoot, $this->argument('name')); - } - } - - /** - * Set the namespace in database factory files. - * - * @return void - */ - protected function setDatabaseFactoryNamespaces() - { - $this->replaceIn( - $this->laravel->databasePath().'/factories/ModelFactory.php', $this->currentRoot, $this->argument('name') - ); - } - - /** - * Replace the given string in the given file. - * - * @param string $path - * @param string|array $search - * @param string|array $replace - * @return void - */ - protected function replaceIn($path, $search, $replace) - { - $this->files->put($path, str_replace($search, $replace, $this->files->get($path))); - } - - /** - * Get the path to the Core User class. - * - * @return string - */ - protected function getUserClassPath() - { - return $this->laravel['path'].'/Core/User.php'; - } - - /** - * Get the path to the bootstrap/app.php file. - * - * @return string - */ - protected function getBootstrapPath() - { - return $this->laravel->basePath().'/bootstrap/app.php'; - } - - /** - * Get the path to the Composer.json file. - * - * @return string - */ - protected function getComposerPath() - { - return $this->laravel->basePath().'/composer.json'; - } - - /** - * Get the path to the given configuration file. - * - * @param string $name - * @return string - */ - protected function getConfigPath($name) - { - return $this->laravel['path.config'].'/'.$name.'.php'; - } - - /** - * Get the path to the authentication configuration file. - * - * @return string - */ - protected function getAuthConfigPath() - { - return $this->getConfigPath('auth'); - } - - /** - * Get the path to the services configuration file. - * - * @return string - */ - protected function getServicesConfigPath() - { - return $this->getConfigPath('services'); - } - - /** - * Get the path to the PHPSpec configuration file. - * - * @return string - */ - protected function getPhpSpecConfigPath() - { - return $this->laravel->basePath().'/phpspec.yml'; - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return [ - ['name', InputArgument::REQUIRED, 'The desired namespace.'], - ]; - } -} diff --git a/illuminate/Foundation/Console/ClearCompiledCommand.php b/illuminate/Foundation/Console/ClearCompiledCommand.php deleted file mode 100755 index a2f3c34..0000000 --- a/illuminate/Foundation/Console/ClearCompiledCommand.php +++ /dev/null @@ -1,41 +0,0 @@ -laravel->getCachedCompilePath(); - $servicesPath = $this->laravel->getCachedServicesPath(); - - if (file_exists($compiledPath)) { - @unlink($compiledPath); - } - - if (file_exists($servicesPath)) { - @unlink($servicesPath); - } - } -} diff --git a/illuminate/Foundation/Console/CommandMakeCommand.php b/illuminate/Foundation/Console/CommandMakeCommand.php deleted file mode 100644 index d009dc2..0000000 --- a/illuminate/Foundation/Console/CommandMakeCommand.php +++ /dev/null @@ -1,90 +0,0 @@ -option('handler')) { - $this->call('handler:command', [ - 'name' => $this->argument('name').'Handler', - '--command' => $this->parseName($this->argument('name')), - ]); - } - } - - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - if ($this->option('queued') && $this->option('handler')) { - return __DIR__.'/stubs/command-queued-with-handler.stub'; - } elseif ($this->option('queued')) { - return __DIR__.'/stubs/command-queued.stub'; - } elseif ($this->option('handler')) { - return __DIR__.'/stubs/command-with-handler.stub'; - } else { - return __DIR__.'/stubs/command.stub'; - } - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Commands'; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['handler', null, InputOption::VALUE_NONE, 'Indicates that handler class should be generated.'], - - ['queued', null, InputOption::VALUE_NONE, 'Indicates that command should be queued.'], - ]; - } -} diff --git a/illuminate/Foundation/Console/ConfigCacheCommand.php b/illuminate/Foundation/Console/ConfigCacheCommand.php deleted file mode 100644 index 2152cfa..0000000 --- a/illuminate/Foundation/Console/ConfigCacheCommand.php +++ /dev/null @@ -1,75 +0,0 @@ -files = $files; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $this->call('config:clear'); - - $config = $this->getFreshConfiguration(); - - $this->files->put( - $this->laravel->getCachedConfigPath(), 'info('Configuration cached successfully!'); - } - - /** - * Boot a fresh copy of the application configuration. - * - * @return array - */ - protected function getFreshConfiguration() - { - $app = require $this->laravel->basePath().'/bootstrap/app.php'; - - $app->make('Illuminate\Contracts\Console\Kernel')->bootstrap(); - - return $app['config']->all(); - } -} diff --git a/illuminate/Foundation/Console/ConfigClearCommand.php b/illuminate/Foundation/Console/ConfigClearCommand.php deleted file mode 100644 index bb25a8e..0000000 --- a/illuminate/Foundation/Console/ConfigClearCommand.php +++ /dev/null @@ -1,55 +0,0 @@ -files = $files; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $this->files->delete($this->laravel->getCachedConfigPath()); - - $this->info('Configuration cache cleared!'); - } -} diff --git a/illuminate/Foundation/Console/DownCommand.php b/illuminate/Foundation/Console/DownCommand.php deleted file mode 100755 index 05ad35b..0000000 --- a/illuminate/Foundation/Console/DownCommand.php +++ /dev/null @@ -1,34 +0,0 @@ -laravel->storagePath().'/framework/down'); - - $this->comment('Application is now in maintenance mode.'); - } -} diff --git a/illuminate/Foundation/Console/EnvironmentCommand.php b/illuminate/Foundation/Console/EnvironmentCommand.php deleted file mode 100755 index b227165..0000000 --- a/illuminate/Foundation/Console/EnvironmentCommand.php +++ /dev/null @@ -1,32 +0,0 @@ -line('Current application environment: '.$this->laravel['env'].''); - } -} diff --git a/illuminate/Foundation/Console/EventGenerateCommand.php b/illuminate/Foundation/Console/EventGenerateCommand.php deleted file mode 100644 index b248807..0000000 --- a/illuminate/Foundation/Console/EventGenerateCommand.php +++ /dev/null @@ -1,48 +0,0 @@ -laravel->getProvider( - 'Illuminate\Foundation\Support\Providers\EventServiceProvider' - ); - - foreach ($provider->listens() as $event => $listeners) { - if (!str_contains($event, '\\')) { - continue; - } - - $this->callSilent('make:event', ['name' => $event]); - - foreach ($listeners as $listener) { - $this->callSilent('make:listener', ['name' => $listener, '--event' => $event]); - } - } - - $this->info('Events and listeners generated successfully!'); - } -} diff --git a/illuminate/Foundation/Console/EventMakeCommand.php b/illuminate/Foundation/Console/EventMakeCommand.php deleted file mode 100644 index 6e2a9cd..0000000 --- a/illuminate/Foundation/Console/EventMakeCommand.php +++ /dev/null @@ -1,50 +0,0 @@ -confirmToProceed()) { - return; - } - - $files = new Filesystem; - - $files->deleteDirectory(app_path('Services')); - $files->delete(base_path('resources/views/app.blade.php')); - $files->delete(base_path('resources/views/home.blade.php')); - $files->deleteDirectory(app_path('Http/Controllers/Auth')); - $files->deleteDirectory(base_path('resources/views/auth')); - $files->deleteDirectory(base_path('resources/views/emails')); - $files->delete(app_path('Http/Controllers/HomeController.php')); - - $files->deleteDirectory(base_path('public/css')); - $files->deleteDirectory(base_path('public/fonts')); - $files->put(base_path('resources/assets/less/app.less'), ''.PHP_EOL); - $files->deleteDirectory(base_path('resources/assets/less/bootstrap')); - - $files->delete(base_path('database/migrations/2014_10_12_000000_create_users_table.php')); - $files->delete(base_path('database/migrations/2014_10_12_100000_create_password_resets_table.php')); - - $files->put(app_path('Http/routes.php'), $files->get(__DIR__.'/stubs/fresh-routes.stub')); - $files->put(app_path('Providers/AppServiceProvider.php'), $files->get(__DIR__.'/stubs/fresh-app-provider.stub')); - - $this->info('Scaffolding removed! Enjoy your fresh start.'); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'], - ]; - } -} diff --git a/illuminate/Foundation/Console/HandlerCommandCommand.php b/illuminate/Foundation/Console/HandlerCommandCommand.php deleted file mode 100644 index 33de193..0000000 --- a/illuminate/Foundation/Console/HandlerCommandCommand.php +++ /dev/null @@ -1,84 +0,0 @@ -option('command')), $stub - ); - - $stub = str_replace( - 'DummyFullCommand', $this->option('command'), $stub - ); - - return $stub; - } - - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - return __DIR__.'/stubs/command-handler.stub'; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Handlers\Commands'; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['command', null, InputOption::VALUE_REQUIRED, 'The command class the handler handles.'], - ]; - } -} diff --git a/illuminate/Foundation/Console/HandlerEventCommand.php b/illuminate/Foundation/Console/HandlerEventCommand.php deleted file mode 100644 index 5fa9927..0000000 --- a/illuminate/Foundation/Console/HandlerEventCommand.php +++ /dev/null @@ -1,96 +0,0 @@ -option('event'); - - if (!starts_with($event, $this->laravel->getNamespace())) { - $event = $this->laravel->getNamespace().'Events\\'.$event; - } - - $stub = str_replace( - 'DummyEvent', class_basename($event), $stub - ); - - $stub = str_replace( - 'DummyFullEvent', $event, $stub - ); - - return $stub; - } - - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - if ($this->option('queued')) { - return __DIR__.'/stubs/event-handler-queued.stub'; - } else { - return __DIR__.'/stubs/event-handler.stub'; - } - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Handlers\Events'; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['event', null, InputOption::VALUE_REQUIRED, 'The event class the handler handles.'], - - ['queued', null, InputOption::VALUE_NONE, 'Indicates the event handler should be queued.'], - ]; - } -} diff --git a/illuminate/Foundation/Console/JobMakeCommand.php b/illuminate/Foundation/Console/JobMakeCommand.php deleted file mode 100644 index 8e1aeee..0000000 --- a/illuminate/Foundation/Console/JobMakeCommand.php +++ /dev/null @@ -1,67 +0,0 @@ -option('queued')) { - return __DIR__.'/stubs/job-queued.stub'; - } else { - return __DIR__.'/stubs/job.stub'; - } - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Jobs'; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['queued', null, InputOption::VALUE_NONE, 'Indicates that job should be queued.'], - ]; - } -} diff --git a/illuminate/Foundation/Console/KeyGenerateCommand.php b/illuminate/Foundation/Console/KeyGenerateCommand.php deleted file mode 100755 index 21978e6..0000000 --- a/illuminate/Foundation/Console/KeyGenerateCommand.php +++ /dev/null @@ -1,76 +0,0 @@ -getRandomKey($this->laravel['config']['app.cipher']); - - if ($this->option('show')) { - return $this->line(''.$key.''); - } - - $path = base_path('.env'); - - if (file_exists($path)) { - file_put_contents($path, str_replace( - $this->laravel['config']['app.key'], $key, file_get_contents($path) - )); - } - - $this->laravel['config']['app.key'] = $key; - - $this->info("Application key [$key] set successfully."); - } - - /** - * Generate a random key for the application. - * - * @param string $cipher - * @return string - */ - protected function getRandomKey($cipher) - { - if ($cipher === 'AES-128-CBC') { - return str_random(16); - } - - return str_random(32); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['show', null, InputOption::VALUE_NONE, 'Simply display the key instead of modifying files.'], - ]; - } -} diff --git a/illuminate/Foundation/Console/ListenerMakeCommand.php b/illuminate/Foundation/Console/ListenerMakeCommand.php deleted file mode 100644 index 8f56792..0000000 --- a/illuminate/Foundation/Console/ListenerMakeCommand.php +++ /dev/null @@ -1,96 +0,0 @@ -option('event'); - - if (!starts_with($event, $this->laravel->getNamespace())) { - $event = $this->laravel->getNamespace().'Events\\'.$event; - } - - $stub = str_replace( - 'DummyEvent', class_basename($event), $stub - ); - - $stub = str_replace( - 'DummyFullEvent', $event, $stub - ); - - return $stub; - } - - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - if ($this->option('queued')) { - return __DIR__.'/stubs/listener-queued.stub'; - } else { - return __DIR__.'/stubs/listener.stub'; - } - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Listeners'; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['event', null, InputOption::VALUE_REQUIRED, 'The event class the being listened for.'], - - ['queued', null, InputOption::VALUE_NONE, 'Indicates the event listener should be queued.'], - ]; - } -} diff --git a/illuminate/Foundation/Console/ModelMakeCommand.php b/illuminate/Foundation/Console/ModelMakeCommand.php deleted file mode 100644 index 6275d93..0000000 --- a/illuminate/Foundation/Console/ModelMakeCommand.php +++ /dev/null @@ -1,79 +0,0 @@ -option('migration')) { - $table = str_plural(snake_case(class_basename($this->argument('name')))); - - $this->call('make:migration', ['name' => "create_{$table}_table", '--create' => $table]); - } - } - } - - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - return __DIR__.'/stubs/model.stub'; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['migration', 'm', InputOption::VALUE_NONE, 'Create a new migration file for the model.'], - ]; - } -} diff --git a/illuminate/Foundation/Console/Optimize/config.php b/illuminate/Foundation/Console/Optimize/config.php deleted file mode 100755 index 4727339..0000000 --- a/illuminate/Foundation/Console/Optimize/config.php +++ /dev/null @@ -1,202 +0,0 @@ -composer = $composer; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $this->info('Generating optimized class loader'); - - if ($this->option('psr')) { - $this->composer->dumpAutoloads(); - } else { - $this->composer->dumpOptimized(); - } - - if ($this->option('force') || !$this->laravel['config']['app.debug']) { - $this->info('Compiling common classes'); - - $this->compileClasses(); - } else { - $this->call('clear-compiled'); - } - } - - /** - * Generate the compiled class file. - * - * @return void - */ - protected function compileClasses() - { - $this->registerClassPreloaderCommand(); - - $this->callSilent('compile', [ - '--config' => implode(',', $this->getClassFiles()), - '--output' => $this->laravel->getCachedCompilePath(), - '--strip_comments' => 1, - ]); - } - - /** - * Get the classes that should be combined and compiled. - * - * @return array - */ - protected function getClassFiles() - { - $app = $this->laravel; - - $core = require __DIR__.'/Optimize/config.php'; - - $files = array_merge($core, $this->laravel['config']->get('compile.files', [])); - - foreach ($this->laravel['config']->get('compile.providers', []) as $provider) { - $files = array_merge($files, forward_static_call([$provider, 'compiles'])); - } - - return $files; - } - - /** - * Register the pre-compiler command instance with Artisan. - * - * @return void - */ - protected function registerClassPreloaderCommand() - { - $this->getApplication()->add(new PreCompileCommand); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['force', null, InputOption::VALUE_NONE, 'Force the compiled class file to be written.'], - - ['psr', null, InputOption::VALUE_NONE, 'Do not optimize Composer dump-autoload.'], - ]; - } -} diff --git a/illuminate/Foundation/Console/ProviderMakeCommand.php b/illuminate/Foundation/Console/ProviderMakeCommand.php deleted file mode 100644 index fa887ed..0000000 --- a/illuminate/Foundation/Console/ProviderMakeCommand.php +++ /dev/null @@ -1,50 +0,0 @@ -kernel = $kernel; - } - - /** - * Fire the job. - * - * @param \Illuminate\Queue\Jobs\Job $job - * @param array $data - * @return void - */ - public function fire($job, $data) - { - call_user_func_array([$this->kernel, 'call'], $data); - - $job->delete(); - } -} diff --git a/illuminate/Foundation/Console/RequestMakeCommand.php b/illuminate/Foundation/Console/RequestMakeCommand.php deleted file mode 100644 index 95b7a87..0000000 --- a/illuminate/Foundation/Console/RequestMakeCommand.php +++ /dev/null @@ -1,50 +0,0 @@ -files = $files; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $this->call('route:clear'); - - $routes = $this->getFreshApplicationRoutes(); - - if (count($routes) == 0) { - return $this->error("Your application doesn't have any routes."); - } - - foreach ($routes as $route) { - $route->prepareForSerialization(); - } - - $this->files->put( - $this->laravel->getCachedRoutesPath(), $this->buildRouteCacheFile($routes) - ); - - $this->info('Routes cached successfully!'); - } - - /** - * Boot a fresh copy of the application and get the routes. - * - * @return \Illuminate\Routing\RouteCollection - */ - protected function getFreshApplicationRoutes() - { - $app = require $this->laravel->basePath().'/bootstrap/app.php'; - - $app->make('Illuminate\Contracts\Console\Kernel')->bootstrap(); - - return $app['router']->getRoutes(); - } - - /** - * Build the route cache file. - * - * @param \Illuminate\Routing\RouteCollection $routes - * @return string - */ - protected function buildRouteCacheFile(RouteCollection $routes) - { - $stub = $this->files->get(__DIR__.'/stubs/routes.stub'); - - return str_replace('{{routes}}', base64_encode(serialize($routes)), $stub); - } -} diff --git a/illuminate/Foundation/Console/RouteClearCommand.php b/illuminate/Foundation/Console/RouteClearCommand.php deleted file mode 100644 index a14b280..0000000 --- a/illuminate/Foundation/Console/RouteClearCommand.php +++ /dev/null @@ -1,55 +0,0 @@ -files = $files; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $this->files->delete($this->laravel->getCachedRoutesPath()); - - $this->info('Route cache cleared!'); - } -} diff --git a/illuminate/Foundation/Console/RouteListCommand.php b/illuminate/Foundation/Console/RouteListCommand.php deleted file mode 100755 index 5a6b19a..0000000 --- a/illuminate/Foundation/Console/RouteListCommand.php +++ /dev/null @@ -1,262 +0,0 @@ -router = $router; - $this->routes = $router->getRoutes(); - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - if (count($this->routes) == 0) { - return $this->error("Your application doesn't have any routes."); - } - - $this->displayRoutes($this->getRoutes()); - } - - /** - * Compile the routes into a displayable format. - * - * @return array - */ - protected function getRoutes() - { - $results = []; - - foreach ($this->routes as $route) { - $results[] = $this->getRouteInformation($route); - } - - return array_filter($results); - } - - /** - * Get the route information for a given route. - * - * @param \Illuminate\Routing\Route $route - * @return array - */ - protected function getRouteInformation(Route $route) - { - return $this->filterRoute([ - 'host' => $route->domain(), - 'method' => implode('|', $route->methods()), - 'uri' => $route->uri(), - 'name' => $route->getName(), - 'action' => $route->getActionName(), - 'middleware' => $this->getMiddleware($route), - ]); - } - - /** - * Display the route information on the console. - * - * @param array $routes - * @return void - */ - protected function displayRoutes(array $routes) - { - $this->table($this->headers, $routes); - } - - /** - * Get before filters. - * - * @param \Illuminate\Routing\Route $route - * @return string - */ - protected function getMiddleware($route) - { - $middlewares = array_values($route->middleware()); - - $middlewares = array_unique( - array_merge($middlewares, $this->getPatternFilters($route)) - ); - - $actionName = $route->getActionName(); - - if (!empty($actionName) && $actionName !== 'Closure') { - $middlewares = array_merge($middlewares, $this->getControllerMiddleware($actionName)); - } - - return implode(',', $middlewares); - } - - /** - * Get the middleware for the given Controller@action name. - * - * @param string $actionName - * @return array - */ - protected function getControllerMiddleware($actionName) - { - Controller::setRouter($this->laravel['router']); - - $segments = explode('@', $actionName); - - return $this->getControllerMiddlewareFromInstance( - $this->laravel->make($segments[0]), $segments[1] - ); - } - - /** - * Get the middlewares for the given controller instance and method. - * - * @param \Illuminate\Routing\Controller $controller - * @param string $method - * @return array - */ - protected function getControllerMiddlewareFromInstance($controller, $method) - { - $middleware = $this->router->getMiddleware(); - - $results = []; - - foreach ($controller->getMiddleware() as $name => $options) { - if (!$this->methodExcludedByOptions($method, $options)) { - $results[] = array_get($middleware, $name, $name); - } - } - - return $results; - } - - /** - * Determine if the given options exclude a particular method. - * - * @param string $method - * @param array $options - * @return bool - */ - protected function methodExcludedByOptions($method, array $options) - { - return (!empty($options['only']) && !in_array($method, (array) $options['only'])) || - (!empty($options['except']) && in_array($method, (array) $options['except'])); - } - - /** - * Get all of the pattern filters matching the route. - * - * @param \Illuminate\Routing\Route $route - * @return array - */ - protected function getPatternFilters($route) - { - $patterns = []; - - foreach ($route->methods() as $method) { - // For each method supported by the route we will need to gather up the patterned - // filters for that method. We will then merge these in with the other filters - // we have already gathered up then return them back out to these consumers. - $inner = $this->getMethodPatterns($route->uri(), $method); - - $patterns = array_merge($patterns, array_keys($inner)); - } - - return $patterns; - } - - /** - * Get the pattern filters for a given URI and method. - * - * @param string $uri - * @param string $method - * @return array - */ - protected function getMethodPatterns($uri, $method) - { - return $this->router->findPatternFilters( - Request::create($uri, $method) - ); - } - - /** - * Filter the route by URI and / or name. - * - * @param array $route - * @return array|null - */ - protected function filterRoute(array $route) - { - if (($this->option('name') && !str_contains($route['name'], $this->option('name'))) || - $this->option('path') && !str_contains($route['uri'], $this->option('path'))) { - return; - } - - return $route; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['name', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by name.'], - - ['path', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by path.'], - ]; - } -} diff --git a/illuminate/Foundation/Console/ServeCommand.php b/illuminate/Foundation/Console/ServeCommand.php deleted file mode 100644 index 7bb48a8..0000000 --- a/illuminate/Foundation/Console/ServeCommand.php +++ /dev/null @@ -1,57 +0,0 @@ -laravel->publicPath()); - - $host = $this->input->getOption('host'); - - $port = $this->input->getOption('port'); - - $base = $this->laravel->basePath(); - - $this->info("Laravel development server started on http://{$host}:{$port}/"); - - passthru('"'.PHP_BINARY.'"'." -S {$host}:{$port} \"{$base}\"/server.php"); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['host', null, InputOption::VALUE_OPTIONAL, 'The host address to serve the application on.', 'localhost'], - - ['port', null, InputOption::VALUE_OPTIONAL, 'The port to serve the application on.', 8000], - ]; - } -} diff --git a/illuminate/Foundation/Console/Tinker/Presenters/EloquentModelPresenter.php b/illuminate/Foundation/Console/Tinker/Presenters/EloquentModelPresenter.php deleted file mode 100644 index 9b7645f..0000000 --- a/illuminate/Foundation/Console/Tinker/Presenters/EloquentModelPresenter.php +++ /dev/null @@ -1,68 +0,0 @@ -getAttributes(), $value->getRelations()); - - $visible = $value->getVisible(); - - if (count($visible) === 0) { - $visible = array_diff(array_keys($attributes), $value->getHidden()); - } - - if (!$this->showHidden($propertyFilter)) { - return array_intersect_key($attributes, array_flip($visible)); - } - - $properties = []; - - foreach ($attributes as $key => $value) { - if (!in_array($key, $visible)) { - $key = sprintf('%s', $key); - } - - $properties[$key] = $value; - } - - return $properties; - } - - /** - * Decide whether to show hidden properties, based on a ReflectionProperty filter. - * - * @param int $propertyFilter - * @return bool - */ - protected function showHidden($propertyFilter) - { - return $propertyFilter & (ReflectionProperty::IS_PROTECTED | ReflectionProperty::IS_PRIVATE); - } -} diff --git a/illuminate/Foundation/Console/Tinker/Presenters/IlluminateApplicationPresenter.php b/illuminate/Foundation/Console/Tinker/Presenters/IlluminateApplicationPresenter.php deleted file mode 100644 index 4278278..0000000 --- a/illuminate/Foundation/Console/Tinker/Presenters/IlluminateApplicationPresenter.php +++ /dev/null @@ -1,71 +0,0 @@ -$property(); - - if (!is_null($val)) { - $properties[$property] = $val; - } - } catch (Exception $e) { - // - } - } - - return $properties; - } -} diff --git a/illuminate/Foundation/Console/Tinker/Presenters/IlluminateCollectionPresenter.php b/illuminate/Foundation/Console/Tinker/Presenters/IlluminateCollectionPresenter.php deleted file mode 100644 index b89300a..0000000 --- a/illuminate/Foundation/Console/Tinker/Presenters/IlluminateCollectionPresenter.php +++ /dev/null @@ -1,42 +0,0 @@ -all(); - } -} diff --git a/illuminate/Foundation/Console/TinkerCommand.php b/illuminate/Foundation/Console/TinkerCommand.php deleted file mode 100755 index f48aaaf..0000000 --- a/illuminate/Foundation/Console/TinkerCommand.php +++ /dev/null @@ -1,103 +0,0 @@ -getApplication()->setCatchExceptions(false); - - $config = new Configuration; - - $config->getPresenterManager()->addPresenters( - $this->getPresenters() - ); - - $shell = new Shell($config); - $shell->addCommands($this->getCommands()); - $shell->setIncludes($this->argument('include')); - - $shell->run(); - } - - /** - * Get artisan commands to pass through to PsySH. - * - * @return array - */ - protected function getCommands() - { - $commands = []; - - foreach ($this->getApplication()->all() as $name => $command) { - if (in_array($name, $this->commandWhitelist)) { - $commands[] = $command; - } - } - - return $commands; - } - - /** - * Get an array of Laravel tailored Presenters. - * - * @return array - */ - protected function getPresenters() - { - return [ - new EloquentModelPresenter, - new IlluminateCollectionPresenter, - new IlluminateApplicationPresenter, - ]; - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return [ - ['include', InputArgument::IS_ARRAY, 'Include file(s) before starting tinker'], - ]; - } -} diff --git a/illuminate/Foundation/Console/UpCommand.php b/illuminate/Foundation/Console/UpCommand.php deleted file mode 100755 index 82d8385..0000000 --- a/illuminate/Foundation/Console/UpCommand.php +++ /dev/null @@ -1,34 +0,0 @@ -laravel->storagePath().'/framework/down'); - - $this->info('Application is now live.'); - } -} diff --git a/illuminate/Foundation/Console/VendorPublishCommand.php b/illuminate/Foundation/Console/VendorPublishCommand.php deleted file mode 100644 index 55a845e..0000000 --- a/illuminate/Foundation/Console/VendorPublishCommand.php +++ /dev/null @@ -1,165 +0,0 @@ -files = $files; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $paths = ServiceProvider::pathsToPublish( - $this->option('provider'), $this->option('tag') - ); - - if (empty($paths)) { - return $this->comment('Nothing to publish.'); - } - - foreach ($paths as $from => $to) { - if ($this->files->isFile($from)) { - $this->publishFile($from, $to); - } elseif ($this->files->isDirectory($from)) { - $this->publishDirectory($from, $to); - } else { - $this->error("Can't locate path: <{$from}>"); - } - } - - $this->info('Publishing Complete!'); - } - - /** - * Publish the file to the given path. - * - * @param string $from - * @param string $to - * @return void - */ - protected function publishFile($from, $to) - { - if ($this->files->exists($to) && !$this->option('force')) { - return; - } - - $this->createParentDirectory(dirname($to)); - - $this->files->copy($from, $to); - - $this->status($from, $to, 'File'); - } - - /** - * Publish the directory to the given directory. - * - * @param string $from - * @param string $to - * @return void - */ - protected function publishDirectory($from, $to) - { - $manager = new MountManager([ - 'from' => new Flysystem(new LocalAdapter($from)), - 'to' => new Flysystem(new LocalAdapter($to)), - ]); - - foreach ($manager->listContents('from://', true) as $file) { - if ($file['type'] === 'file' && (!$manager->has('to://'.$file['path']) || $this->option('force'))) { - $manager->put('to://'.$file['path'], $manager->read('from://'.$file['path'])); - } - } - - $this->status($from, $to, 'Directory'); - } - - /** - * Create the directory to house the published files if needed. - * - * @param string $directory - * @return void - */ - protected function createParentDirectory($directory) - { - if (!$this->files->isDirectory($directory)) { - $this->files->makeDirectory($directory, 0755, true); - } - } - - /** - * Write a status message to the console. - * - * @param string $from - * @param string $to - * @param string $type - * @return void - */ - protected function status($from, $to, $type) - { - $from = str_replace(base_path(), '', realpath($from)); - - $to = str_replace(base_path(), '', realpath($to)); - - $this->line('Copied '.$type.' ['.$from.'] To ['.$to.']'); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['force', null, InputOption::VALUE_NONE, 'Overwrite any existing files.'], - - ['provider', null, InputOption::VALUE_OPTIONAL, 'The service provider that has assets you want to publish.'], - - ['tag', null, InputOption::VALUE_OPTIONAL, 'The tag that has assets you want to publish.'], - ]; - } -} diff --git a/illuminate/Foundation/Console/ViewClearCommand.php b/illuminate/Foundation/Console/ViewClearCommand.php deleted file mode 100644 index 74b919e..0000000 --- a/illuminate/Foundation/Console/ViewClearCommand.php +++ /dev/null @@ -1,59 +0,0 @@ -files = $files; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $views = $this->files->glob($this->laravel['config']['view.compiled'].'/*'); - - foreach ($views as $view) { - $this->files->delete($view); - } - - $this->info('Compiled views cleared!'); - } -} diff --git a/illuminate/Foundation/Console/stubs/command-handler.stub b/illuminate/Foundation/Console/stubs/command-handler.stub deleted file mode 100644 index 8fdf3ee..0000000 --- a/illuminate/Foundation/Console/stubs/command-handler.stub +++ /dev/null @@ -1,30 +0,0 @@ -setRoutes( - unserialize(base64_decode('{{routes}}')) -);