| Total Complexity | 7 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Coverage | 61.53% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | class StatusCode |
||
| 22 | { |
||
| 23 | /** @var int */ |
||
| 24 | private $statusCode; |
||
| 25 | |||
| 26 | 24 | public function __construct(int $statusCode) |
|
| 27 | { |
||
| 28 | 24 | $this->ensureIsValidStatusCode($statusCode); |
|
| 29 | 24 | $this->statusCode = $statusCode; |
|
| 30 | 24 | } |
|
| 31 | |||
| 32 | public static function createDefault(): self |
||
| 33 | { |
||
| 34 | return new self(200); |
||
| 35 | } |
||
| 36 | |||
| 37 | 24 | public function asInt(): int |
|
| 38 | { |
||
| 39 | 24 | return $this->statusCode; |
|
| 40 | } |
||
| 41 | |||
| 42 | public function equals(self $other): bool |
||
| 43 | { |
||
| 44 | return $this->asInt() === $other->asInt(); |
||
| 45 | } |
||
| 46 | |||
| 47 | 24 | private function ensureIsValidStatusCode(int $statusCode) |
|
| 51 | } |
||
| 52 | 24 | } |
|
| 53 | } |
||
| 54 |