Total Complexity | 5 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class Thumb |
||
14 | { |
||
15 | /** @var Cropper */ |
||
16 | private $cropper; |
||
17 | |||
18 | /** @var string */ |
||
19 | private $uploads; |
||
20 | |||
21 | /** |
||
22 | * Thumb constructor. |
||
23 | */ |
||
24 | public function __construct() |
||
25 | { |
||
26 | $this->cropper = new Cropper(CONF_IMAGE_CACHE, CONF_IMAGE_QUALITY['jpg'], CONF_IMAGE_QUALITY['png']); |
||
27 | $this->uploads = CONF_UPLOAD_DIR; |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * @param string $image |
||
32 | * @param int $width |
||
33 | * @param int|null $height |
||
34 | * @return string |
||
35 | */ |
||
36 | public function make(string $image, int $width, ?int $height = null): string |
||
37 | { |
||
38 | return $this->cropper->make("{$this->uploads}/{$image}", $width, $height); |
||
|
|||
39 | } |
||
40 | |||
41 | /** |
||
42 | * @param string|null $image |
||
43 | */ |
||
44 | public function flush(?string $image = null): void |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @return Cropper |
||
57 | */ |
||
58 | public function cropper(): Cropper |
||
61 | } |
||
62 | } |