Completed
Pull Request — master (#41)
by
unknown
02:46
created

RefreshThumbnailCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 4
dl 0
loc 30
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A fire() 0 8 1
1
<?php namespace Modules\Media\Console;
2
3
use Illuminate\Console\Command;
4
use Illuminate\Foundation\Bus\DispatchesJobs;
5
use Modules\Media\Jobs\RebuildThumbnails;
6
use Modules\Media\Repositories\FileRepository;
7
8
class RefreshThumbnailCommand extends Command
9
{
10
    use DispatchesJobs;
11
    protected $name = 'asgard:media:refresh';
12
    protected $description = 'Create and or refresh the thumbnails';
13
    /**
14
     * @var FileRepository
15
     */
16
    private $file;
17
18
    public function __construct(FileRepository $file)
19
    {
20
        parent::__construct();
21
        $this->file = $file;
22
    }
23
24
    /**
25
     * Execute the console command.
26
     *
27
     * @return mixed
28
     */
29
    public function fire()
30
    {
31
        $this->line('Preparing to regenerate all thumbnails...');
32
33
        $this->dispatch(new RebuildThumbnails($this->file->all()->pluck('path')));
34
35
        $this->info('All thumbnails refreshed');
36
    }
37
}
38