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 ( 69b831...bd71a5 )
by joseph
20:49 queued 13s
created

DateTimeSettableNoDefaultFieldTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 13
dl 0
loc 46
rs 10
c 0
b 0
f 0
ccs 15
cts 15
cp 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getDateTimeSettableNoDefault() 0 7 2
A metaForDateTimeSettableNoDefault() 0 6 1
A setDateTimeSettableNoDefault() 0 8 1
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Traits\DateTime;
4
// phpcs:disable Generic.Files.LineLength.TooLong
5
use DateTimeImmutable;
6
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
7
use EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Interfaces\DateTime\DateTimeSettableNoDefaultFieldInterface;
8
use EdmondsCommerce\DoctrineStaticMeta\MappingHelper;
9
// phpcs:enable
10
/**
11
 * Trait DateTimeSettableNoDefaultFieldTrait
12
 *
13
 * This field is a dateTime that you can set and update the value as you see fit with no defaults
14
 *
15
 * @package EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Traits\DateTime
16
 */
17
trait DateTimeSettableNoDefaultFieldTrait
18
{
19
20
    /**
21
     * @var DateTimeImmutable|null
22
     */
23
    private $dateTimeSettableNoDefault;
24
25
    /**
26
     * @SuppressWarnings(PHPMD.StaticAccess)
27
     * @param ClassMetadataBuilder $builder
28
     */
29 2
    public static function metaForDateTimeSettableNoDefault(ClassMetadataBuilder $builder): void
30
    {
31 2
        MappingHelper::setSimpleDatetimeFields(
32 2
            [DateTimeSettableNoDefaultFieldInterface::PROP_DATE_TIME_SETTABLE_NO_DEFAULT],
33 2
            $builder,
34 2
            DateTimeSettableNoDefaultFieldInterface::DEFAULT_DATE_TIME_SETTABLE_NO_DEFAULT
35
        );
36 2
    }
37
38
    /**
39
     * @return DateTimeImmutable|null
40
     */
41 2
    public function getDateTimeSettableNoDefault(): ?DateTimeImmutable
42
    {
43 2
        if (null === $this->dateTimeSettableNoDefault) {
44 2
            return DateTimeSettableNoDefaultFieldInterface::DEFAULT_DATE_TIME_SETTABLE_NO_DEFAULT;
45
        }
46
47 2
        return $this->dateTimeSettableNoDefault;
48
    }
49
50
    /**
51
     * @param DateTimeImmutable|null $dateTimeSettableNoDefault
52
     *
53
     * @return self
54
     */
55 2
    private function setDateTimeSettableNoDefault(?DateTimeImmutable $dateTimeSettableNoDefault): self
56
    {
57 2
        $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

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