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 (#121)
by joseph
56:14
created

ValidationException::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

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