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

ValidatedEntityTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 36
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A loadValidatorMetaData() 0 3 1
A getValidatorStaticMeta() 0 7 2
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Traits;
4
5
use EdmondsCommerce\DoctrineStaticMeta\Entity\Interfaces\ValidatedEntityInterface;
6
use EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException;
7
use EdmondsCommerce\DoctrineStaticMeta\ValidatorStaticMeta;
8
use Symfony\Component\Validator\Mapping\ClassMetadata as ValidatorClassMetaData;
9
10
/**
11
 * @see ValidatedEntityInterface
12
 */
13
trait ValidatedEntityTrait
14
{
15
    /**
16
     * @var ValidatorStaticMeta|null
17
     */
18
    private static $validatorStaticMeta;
19
20
    /**
21
     * This method is called by the Symfony validation component when loading the meta data
22
     *
23
     * In this method, we pass around the meta data object and add data to it as required.
24
     *
25
     *
26
     *
27
     * @param ValidatorClassMetaData $metadata
28
     *
29
     * @throws DoctrineStaticMetaException
30
     */
31
    public static function loadValidatorMetaData(ValidatorClassMetaData $metadata): void
32
    {
33
        static::getValidatorStaticMeta()->addValidatorMetaData($metadata);
34
    }
35
36
37
    /**
38
     * Get an instance of the ValidatorStaticMeta object for this Entity
39
     *
40
     * @return ValidatorStaticMeta
41
     */
42
    private static function getValidatorStaticMeta(): ValidatorStaticMeta
43
    {
44
        if (null === self::$validatorStaticMeta) {
45
            self::$validatorStaticMeta = new ValidatorStaticMeta(self::getDoctrineStaticMeta());
46
        }
47
48
        return self::$validatorStaticMeta;
49
    }
50
}
51