Test Failed
Push — master ( 2160b1...e71542 )
by Anatoly
09:43 queued 10s
created

InvalidEntityException::getEntityViolations()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
nc 1
nop 0
dl 0
loc 3
c 1
b 0
f 0
cc 1
rs 10
1
<?php declare(strict_types=1);
2
3
namespace App\Exception;
4
5
/**
6
 * Import classes
7
 */
8
use Symfony\Component\Validator\ConstraintViolationListInterface;
9
10
/**
11
 * Import functions
12
 */
13
use function get_class;
14
use function sprintf;
15
16
/**
17
 * InvalidEntityException
18
 */
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
62
    {
63
        return $this->entityViolations;
64
    }
65
}
66