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   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 28.57%

Importance

Changes 0
Metric Value
wmc 4
eloc 14
dl 0
loc 43
rs 10
c 0
b 0
f 0
ccs 4
cts 14
cp 0.2857

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getValidationErrors() 0 3 1
A __construct() 0 17 2
A getInvalidEntity() 0 3 1
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