Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
87.50% |
7 / 8 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| UnknownExistingEntityError | |
87.50% |
7 / 8 |
|
50.00% |
1 / 2 |
2.01 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 | |||
| getStatusCode | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | namespace Apie\Core\Exceptions; |
| 3 | |
| 4 | use Apie\Core\Entities\EntityInterface; |
| 5 | use ReflectionClass; |
| 6 | |
| 7 | final class UnknownExistingEntityError extends ApieException implements HttpStatusCodeException |
| 8 | { |
| 9 | public function __construct(EntityInterface $entity) |
| 10 | { |
| 11 | parent::__construct( |
| 12 | sprintf( |
| 13 | "Entity '%s' with id '%s' is not found in the persistence layer!", |
| 14 | (new ReflectionClass($entity))->getShortName(), |
| 15 | $entity->getId()->toNative() |
| 16 | ) |
| 17 | ); |
| 18 | } |
| 19 | |
| 20 | public function getStatusCode(): int |
| 21 | { |
| 22 | return 409; |
| 23 | } |
| 24 | } |