Total Complexity | 4 |
Total Lines | 66 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | trait HasSize |
||
6 | { |
||
7 | |||
8 | /** |
||
9 | * Image width. |
||
10 | * |
||
11 | * @var float |
||
12 | */ |
||
13 | protected float $width; |
||
14 | |||
15 | /** |
||
16 | * Image height. |
||
17 | * |
||
18 | * @var float |
||
19 | */ |
||
20 | protected float $height; |
||
21 | |||
22 | /** |
||
23 | * @param float $width |
||
24 | * |
||
25 | * @return static |
||
26 | */ |
||
27 | 2 | public function width(float $width): static |
|
28 | { |
||
29 | 2 | $this->width = $width; |
|
30 | |||
31 | 2 | return $this; |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * @param float $height |
||
36 | * |
||
37 | * @return static |
||
38 | */ |
||
39 | 1 | public function height(float $height): static |
|
40 | { |
||
41 | 1 | $this->height = $height; |
|
42 | |||
43 | 1 | return $this; |
|
44 | } |
||
45 | |||
46 | /** |
||
47 | * @param float $size |
||
48 | * |
||
49 | * @return static |
||
50 | */ |
||
51 | 1 | public function square(float $size): static |
|
52 | { |
||
53 | 1 | $this->width = $size; |
|
54 | 1 | $this->height = $size; |
|
55 | |||
56 | 1 | return $this; |
|
57 | } |
||
58 | |||
59 | /** |
||
60 | * @param float $width |
||
61 | * @param float $height |
||
62 | * |
||
63 | * @return static |
||
64 | */ |
||
65 | 1 | public function size(float $width, float $height): static |
|
71 | } |
||
72 | } |
||
73 |