Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
8 / 8 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| EntityNotFoundException | |
100.00% |
8 / 8 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 | |||
| getStatusCode | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\Core\Exceptions; |
| 3 | |
| 4 | use Apie\Core\Entities\EntityInterface; |
| 5 | use Apie\Core\Identifiers\IdentifierInterface; |
| 6 | |
| 7 | final class EntityNotFoundException extends ApieException implements HttpStatusCodeException |
| 8 | { |
| 9 | /** |
| 10 | * @param IdentifierInterface<EntityInterface> $identifier |
| 11 | */ |
| 12 | public function __construct(IdentifierInterface $identifier) |
| 13 | { |
| 14 | parent::__construct( |
| 15 | sprintf( |
| 16 | "Entity '%s' with id '%s' is not found!", |
| 17 | $identifier::getReferenceFor()->getShortName(), |
| 18 | $identifier->toNative() |
| 19 | ) |
| 20 | ); |
| 21 | } |
| 22 | |
| 23 | public function getStatusCode(): int |
| 24 | { |
| 25 | return 404; |
| 26 | } |
| 27 | } |