Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| SizeSpec | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| size | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Cosray\Assets; |
| 6 | |
| 7 | /** A validated named entry from the `media.sizes` config. */ |
| 8 | final class SizeSpec |
| 9 | { |
| 10 | public function __construct( |
| 11 | public readonly string $name, |
| 12 | public readonly ResizeMode $mode, |
| 13 | public readonly int $first, |
| 14 | public readonly ?int $second = null, |
| 15 | public readonly ?int $pos = null, |
| 16 | public readonly ?int $quality = null, |
| 17 | public readonly bool $enlarge = false, |
| 18 | ) {} |
| 19 | |
| 20 | public function size(): Size |
| 21 | { |
| 22 | return new Size($this->first, $this->second, $this->pos); |
| 23 | } |
| 24 | } |