GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 54405e...4eecae )
by Marc
02:12 queued 24s
created

RouteTranslationsClearCommand::handle()   A

Complexity

Conditions 4
Paths 6

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
cc 4
nc 6
nop 0
1
<?php
2
3
namespace Mcamara\LaravelLocalization\Commands;
4
5
use Mcamara\LaravelLocalization\Traits\TranslatedRouteCommandContext;
6
use Illuminate\Console\Command;
7
use Illuminate\Filesystem\Filesystem;
8
9
class RouteTranslationsClearCommand extends Command
10
{
11
    use TranslatedRouteCommandContext;
12
13
    /**
14
     * The console command name.
15
     *
16
     * @var string
17
     */
18
    protected $name = 'route:trans:clear';
19
20
    /**
21
     * The console command description.
22
     *
23
     * @var string
24
     */
25
    protected $description = 'Remove the translated route cache files for each locale';
26
27
    /**
28
     * The filesystem instance.
29
     *
30
     * @var \Illuminate\Filesystem\Filesystem
31
     */
32
    protected $files;
33
34
    /**
35
     * Create a new route clear command instance.
36
     *
37
     * @param  \Illuminate\Filesystem\Filesystem  $files
38
     */
39
    public function __construct(Filesystem $files)
40
    {
41
        parent::__construct();
42
43
        $this->files = $files;
44
    }
45
46
    /**
47
     * Execute the console command.
48
     *
49
     * @return void
50
     */
51
    public function handle()
52
    {
53
        foreach ($this->getSupportedLocales() as $locale) {
54
55
            $path = $this->makeLocaleRoutesPath($locale);
56
57
            if ($this->files->exists($path)) {
58
                $this->files->delete($path);
59
            }
60
        }
61
62
        $path = $this->laravel->getCachedRoutesPath();
63
64
        if ($this->files->exists($path)) {
65
            $this->files->delete($path);
66
        }
67
68
        $this->info('Route caches for locales cleared!');
69
    }
70
}
71