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 (#152)
by joseph
17:58
created

setDateTimeSettableNoDefault()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
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\Fields\Traits\DateTime;
4
5
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
6
use EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Interfaces\DateTime\DateTimeSettableNoDefaultFieldInterface;
7
use EdmondsCommerce\DoctrineStaticMeta\MappingHelper;
8
9
/**
10
 * Trait DateTimeSettableNoDefaultFieldTrait
11
 *
12
 * This field is a dateTime that you can set and update the value as you see fit with no defaults
13
 *
14
 * @package EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Traits\DateTime
15
 */
16
trait DateTimeSettableNoDefaultFieldTrait
17
{
18
19
    /**
20
     * @var \DateTime|null
21
     */
22
    private $dateTimeSettableNoDefault;
23
24
    /**
25
     * @SuppressWarnings(PHPMD.StaticAccess)
26
     * @param ClassMetadataBuilder $builder
27
     */
28
    public static function metaForDateTimeSettableNoDefault(ClassMetadataBuilder $builder): void
29
    {
30
        MappingHelper::setSimpleDatetimeFields(
31
            [DateTimeSettableNoDefaultFieldInterface::PROP_DATE_TIME_SETTABLE_NO_DEFAULT],
32
            $builder,
33
            DateTimeSettableNoDefaultFieldInterface::DEFAULT_DATE_TIME_SETTABLE_NO_DEFAULT
34
        );
35
    }
36
37
    /**
38
     * @return \DateTime|null
39
     */
40
    public function getDateTimeSettableNoDefault(): ?\DateTime
41
    {
42
        if (null === $this->dateTimeSettableNoDefault) {
43
            return DateTimeSettableNoDefaultFieldInterface::DEFAULT_DATE_TIME_SETTABLE_NO_DEFAULT;
44
        }
45
46
        return $this->dateTimeSettableNoDefault;
47
    }
48
49
    /**
50
     * @param \DateTime|null $dateTimeSettableNoDefault
51
     *
52
     * @return self
53
     */
54
    private function setDateTimeSettableNoDefault(?\DateTime $dateTimeSettableNoDefault): self
55
    {
56
        $this->updatePropertyValue(
0 ignored issues
show
Bug introduced by
It seems like updatePropertyValue() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

56
        $this->/** @scrutinizer ignore-call */ 
57
               updatePropertyValue(
Loading history...
57
            DateTimeSettableNoDefaultFieldInterface::PROP_DATE_TIME_SETTABLE_NO_DEFAULT,
58
            $dateTimeSettableNoDefault
59
        );
60
61
        return $this;
62
    }
63
}
64