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

RebuildThumbnails::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
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