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 (#51)
by joseph
102:38 queued 99:24
created

validatorMetaForActionedDate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
c 0
b 0
f 0
ccs 0
cts 4
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Traits\Date;
4
5
// phpcs:disable
6
7
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
8
use EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Interfaces\Date\ActionedDateFieldInterface;
9
use EdmondsCommerce\DoctrineStaticMeta\Entity\Interfaces\ValidatedEntityInterface;
10
use EdmondsCommerce\DoctrineStaticMeta\MappingHelper;
11
use Symfony\Component\Validator\Constraints\DateTime;
12
use Symfony\Component\Validator\Mapping\ClassMetadata as ValidatorClassMetaData;
13
14
// phpcs:enable
15
trait ActionedDateFieldTrait
16
{
17
18
    /**
19
     * @var \DateTime|null
20
     */
21
    private $actionedDate;
22
23
    /**
24
     * @SuppressWarnings(PHPMD.StaticAccess)
25
     * @param ClassMetadataBuilder $builder
26
     */
27
    public static function metaForActionedDate(ClassMetadataBuilder $builder): void
28
    {
29
        MappingHelper::setSimpleDatetimeFields(
30
            [ActionedDateFieldInterface::PROP_ACTIONED_DATE],
31
            $builder
32
        );
33
    }
34
35
    /**
36
     * @param ValidatorClassMetaData $metadata
37
     *
38
     * @throws \Symfony\Component\Validator\Exception\MissingOptionsException
39
     * @throws \Symfony\Component\Validator\Exception\InvalidOptionsException
40
     * @throws \Symfony\Component\Validator\Exception\ConstraintDefinitionException
41
     */
42
    protected static function validatorMetaForActionedDate(ValidatorClassMetaData $metadata): void
43
    {
44
        $metadata->addPropertyConstraint(
45
            ActionedDateFieldInterface::PROP_ACTIONED_DATE,
46
            new DateTime()
47
        );
48
    }
49
50
    /**
51
     * @return \DateTime|null
52
     */
53 1
    public function getActionedDate(): ?\DateTime
54
    {
55 1
        return $this->actionedDate;
56
    }
57
58
    /**
59
     * @param \DateTime|null $actionedDate
60
     *
61
     * @return $this|ActionedDateFieldInterface
62
     */
63 1
    public function setActionedDate(?\DateTime $actionedDate): self
64
    {
65 1
        $this->actionedDate = $actionedDate;
66 1
        if ($this instanceof ValidatedEntityInterface) {
67 1
            $this->validateProperty(ActionedDateFieldInterface::PROP_ACTIONED_DATE);
68
        }
69
70 1
        return $this;
71
    }
72
}
73