/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
src/Illuminate/Foundation/Console/OptimizeCommand.php
69 строк
2 KB
Lucas Michot
Use strict comparisons for int-to-int checks (#61005)
03 авг 2026, 20:45
Не верифицирован
03 авг 2026, 20:45
b1d45e2
Код
Авторство
О чём код?
<?php namespace Illuminate\Foundation\Console; use Illuminate\Console\Command; use Illuminate\Support\Collection; use Illuminate\Support\ServiceProvider; use Illuminate\Support\Stringable; use Symfony\Component\Console\Attribute\AsCommand; #[AsCommand(name: 'optimize')] class OptimizeCommand extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'optimize {--e|except= : Do not run the commands matching the key or name}'; /** * The console command description. * * @var string */ protected $description = 'Cache framework bootstrap, configuration, and metadata to increase performance'; /** * Execute the console command. * * @return void */ public function handle() { $this->components->info('Caching framework bootstrap, configuration, and metadata.'); $exceptions = (new Stringable($this->option('except') ?? ''))->explode(',') ->map(fn ($except) => trim($except)) ->filter() ->unique() ->flip(); $tasks = Collection::wrap($this->getOptimizeTasks()) ->reject(fn ($command, $key) => $exceptions->hasAny([$command, $key])) ->toArray(); foreach ($tasks as $description => $command) { $this->components->task($description, fn () => $this->callSilently($command) === 0); } $this->newLine(); } /** * Get the commands that should be run to optimize the framework. * * @return array */ protected function getOptimizeTasks() { return [ 'config' => 'config:cache', 'events' => 'event:cache', 'routes' => 'route:cache', 'views' => 'view:cache', ...ServiceProvider::$optimizeCommands, ]; } }