Вход Регистрация
Файл: vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeClearCommand.php
Строк: 93
<?php

namespace IlluminateFoundationConsole;

use 
IlluminateConsoleCommand;
use 
IlluminateSupportCollection;
use 
IlluminateSupportServiceProvider;
use 
SymfonyComponentConsoleAttributeAsCommand;
use 
SymfonyComponentConsoleInputInputOption;

#[AsCommand(name: 'optimize:clear')]
class OptimizeClearCommand extends Command
{
    
/**
     * The console command name.
     *
     * @var string
     */
    
protected $name 'optimize:clear';

    
/**
     * The console command description.
     *
     * @var string
     */
    
protected $description 'Remove the cached bootstrap files';

    
/**
     * Execute the console command.
     *
     * @return void
     */
    
public function handle()
    {
        
$this->components->info('Clearing cached bootstrap files.');

        
$exceptions Collection::wrap(explode(','$this->option('except') ?? ''))
            ->
map(fn ($except) => trim($except))
            ->
filter()
            ->
unique()
            ->
flip();

        
$tasks Collection::wrap($this->getOptimizeClearTasks())
            ->
reject(fn ($command$key) => $exceptions->hasAny([$command$key]))
            ->
toArray();

        foreach (
$tasks as $description => $command) {
            
$this->components->task($descriptionfn () => $this->callSilently($command) == 0);
        }

        
$this->newLine();
    }

    
/**
     * Get the commands that should be run to clear the "optimization" files.
     *
     * @return array
     */
    
public function getOptimizeClearTasks()
    {
        return [
            
'config' => 'config:clear',
            
'cache' => 'cache:clear',
            
'compiled' => 'clear-compiled',
            
'events' => 'event:clear',
            
'routes' => 'route:clear',
            
'views' => 'view:clear',
            ...
ServiceProvider::$optimizeClearCommands,
        ];
    }

    
/**
     * Get the console command arguments.
     *
     * @return array
     */
    
protected function getOptions()
    {
        return [
            [
'except''e'InputOption::VALUE_OPTIONAL'The commands to skip'],
        ];
    }
}
Онлайн: 1
Реклама