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

RebuildThumbnails   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 9 2
1
<?php namespace Modules\Media\Jobs;
2
3
use App\Jobs\Job;
4
use Illuminate\Contracts\Bus\SelfHandling;
5
use Illuminate\Contracts\Queue\ShouldQueue;
6
use Illuminate\Database\Eloquent\Collection;
7
use Illuminate\Queue\InteractsWithQueue;
8
use Illuminate\Queue\SerializesModels;
9
10
class RebuildThumbnails extends Job implements SelfHandling, ShouldQueue
11
{
12
    use InteractsWithQueue, SerializesModels;
13
14
    /**
15
     * @var Collection
16
     */
17
    private $paths;
18
19
    public function __construct(Collection $paths)
20
    {
21
        $this->paths = $paths;
22
    }
23
24
    public function handle()
25
    {
26
        $imagy = app('imagy');
27
28
        foreach ($this->paths as $path) {
29
            app('log')->info('Generating thumbnails for path: ' . $path);
30
            $imagy->createAll($path);
31
        }
32
    }
33
}
34