Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
Size
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
4
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
4
1<?php
2
3declare(strict_types=1);
4
5namespace Cosray\Assets;
6
7use Cosray\Exception\RuntimeException;
8
9class Size
10{
11    public function __construct(
12        public readonly int $firstDimension,
13        public readonly ?int $secondDimension = null,
14        public readonly int|array|null $cropMode = null,
15    ) {
16        if ($firstDimension < 1) {
17            throw new RuntimeException('Assets error: width must be >= 1');
18        }
19
20        if ($secondDimension && $secondDimension < 1) {
21            throw new RuntimeException('Assets error: width must be >= 1');
22        }
23    }
24}