GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#57)
by joseph
16:59
created

ValidationException::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 8
cts 8
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 4
crap 2
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Exception;
4
5
use EdmondsCommerce\DoctrineStaticMeta\Entity\Interfaces\EntityInterface;
6
use EdmondsCommerce\DoctrineStaticMeta\Exception\Traits\RelativePathTraceTrait;
7
use Symfony\Component\Validator\ConstraintViolationInterface;
8
use Symfony\Component\Validator\ConstraintViolationListInterface;
9
10
class ValidationException extends DoctrineStaticMetaException
11
{
12
    use RelativePathTraceTrait;
13
14
    protected $entity;
15
16
    protected $errors;
17
18
    /**
19
     * ValidationException constructor.
20
     *
21
     * @param ConstraintViolationListInterface|ConstraintViolationInterface[] $errors
22
     * @param EntityInterface                                                 $entity
23
     * @param int                                                             $code
24
     * @param \Exception|null                                                 $previous
25
     */
26 3
    public function __construct(
27
        ConstraintViolationListInterface $errors,
28
        EntityInterface $entity,
29
        $code = 0,
30
        \Exception $previous = null
31
    ) {
32 3
        $this->entity = $entity;
33 3
        $this->errors = $errors;
34
35 3
        $message = 'found '.$errors->count().' errors validating entity '.$entity->getShortName();
36 3
        foreach ($errors as $error) {
37 1
            $message .= "\n".$error->getPropertyPath().': '.$error->getMessage();
38
        }
39 3
        $message .= "\nEntity:".$entity->__toString();
40
41 3
        parent::__construct($message, $code, $previous);
42 3
    }
43
44 1
    public function getInvalidEntity(): EntityInterface
45
    {
46 1
        return $this->entity;
47
    }
48
49 1
    public function getValidationErrors(): ConstraintViolationListInterface
50
    {
51 1
        return $this->errors;
52
    }
53
}
54