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
Push — master ( a48bd8...83d092 )
by joseph
16:18 queued 18s
created

buildEntityDataValidator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 8
ccs 0
cts 7
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Validation;
4
5
use EdmondsCommerce\DoctrineStaticMeta\Entity\Interfaces\Validation\EntityDataValidatorInterface;
6
use Symfony\Component\Validator\Mapping\Cache\DoctrineCache;
7
use Symfony\Component\Validator\Validation;
8
9
class EntityDataValidatorFactory
10
{
11
    /**
12
     * The public static method that is called to load the validator meta data
13
     *
14
     * @see https://symfony.com/doc/current/validation.html
15
     *
16
     * @see https://symfony.com/doc/current/components/validator/resources.html#the-staticmethodloader
17
     *
18
     */
19
    public const METHOD_LOAD_VALIDATOR_META_DATA = 'loadValidatorMetadata';
20
21
    /**
22
     * @var DoctrineCache
23
     */
24
    protected $doctrineCache;
25
26
    /**
27
     * ValidatorFactory constructor.
28
     *
29
     * You need to specify the cache driver implementation at the DI level
30
     *
31
     * @param DoctrineCache $doctrineCache
32
     */
33
    public function __construct(DoctrineCache $doctrineCache)
34
    {
35
        $this->doctrineCache = $doctrineCache;
36
    }
37
38
    /**
39
     * Build an EntityDataValidatorInterface
40
     *
41
     * @return EntityDataValidatorInterface
42
     * @SuppressWarnings(PHPMD.StaticAccess)
43
     */
44
    public function buildEntityDataValidator(): EntityDataValidatorInterface
45
    {
46
        $builder = Validation::createValidatorBuilder();
47
        $builder->addMethodMapping(self::METHOD_LOAD_VALIDATOR_META_DATA);
48
        $builder->setMetadataCache($this->doctrineCache);
49
        $validator = $builder->getValidator();
50
51
        return new EntityDataValidator($validator);
52
    }
53
}
54