| Total Complexity | 4 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | class Result implements ResultInterface |
||
| 22 | { |
||
| 23 | /** |
||
| 24 | * Check status. |
||
| 25 | * |
||
| 26 | * @var bool |
||
| 27 | */ |
||
| 28 | protected $status; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Failure reason. |
||
| 32 | * |
||
| 33 | * @var string|null |
||
| 34 | */ |
||
| 35 | protected $reason; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Constructor |
||
| 39 | * |
||
| 40 | * @param bool $status Check status. |
||
| 41 | * @param string|null $reason Failure reason. |
||
| 42 | */ |
||
| 43 | 12 | public function __construct(bool $status, ?string $reason = null) |
|
| 44 | { |
||
| 45 | 12 | $this->status = (bool)$status; |
|
| 46 | 12 | if ($reason !== null) { |
|
| 47 | 1 | $this->reason = (string)$reason; |
|
| 48 | } |
||
| 49 | 12 | } |
|
| 50 | |||
| 51 | /** |
||
| 52 | * {@inheritDoc} |
||
| 53 | */ |
||
| 54 | 1 | public function getReason(): ?string |
|
| 55 | { |
||
| 56 | 1 | return $this->reason; |
|
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * {@inheritDoc} |
||
| 61 | */ |
||
| 62 | 10 | public function getStatus(): bool |
|
| 65 | } |
||
| 66 | } |
||
| 67 |