Total Complexity | 3 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
19 | final class InvalidEntityException extends AbstractException |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * An invalid entity |
||
24 | * |
||
25 | * @var object |
||
26 | */ |
||
27 | private $invalidEntity; |
||
28 | |||
29 | /** |
||
30 | * An entity violations |
||
31 | * |
||
32 | * @var ConstraintViolationListInterface |
||
33 | */ |
||
34 | private $entityViolations; |
||
35 | |||
36 | /** |
||
37 | * Constructor of the class |
||
38 | * |
||
39 | * @param object $invalidEntity |
||
40 | * @param ConstraintViolationListInterface $entityViolations |
||
41 | */ |
||
42 | public function __construct(object $invalidEntity, ConstraintViolationListInterface $entityViolations) |
||
43 | { |
||
44 | $this->invalidEntity = $invalidEntity; |
||
45 | $this->entityViolations = $entityViolations; |
||
46 | |||
47 | parent::__construct(sprintf('Invalid the entity "%s"', get_class($invalidEntity))); |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @return object |
||
52 | */ |
||
53 | public function getInvalidEntity() : object |
||
54 | { |
||
55 | return $this->invalidEntity; |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * @return ConstraintViolationListInterface |
||
60 | */ |
||
61 | public function getEntityViolations() : ConstraintViolationListInterface |
||
64 | } |
||
65 | } |
||
66 |