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 (#166)
by Ross
06:42
created

metaForDefaultsEnabled()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1.0046

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 6
ccs 5
cts 6
cp 0.8333
crap 1.0046
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Traits\Boolean;
4
5
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
6
use EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Interfaces\Boolean\DefaultsEnabledFieldInterface;
7
use EdmondsCommerce\DoctrineStaticMeta\MappingHelper;
8
9
trait DefaultsEnabledFieldTrait
10
{
11
12
    /**
13
     * @var bool
14
     */
15
    private $defaultsEnabled = DefaultsEnabledFieldInterface::DEFAULT_DEFAULTS_ENABLED;
16
17
    /**
18
     * @SuppressWarnings(PHPMD.StaticAccess)
19
     * @param ClassMetadataBuilder $builder
20
     */
21 2
    public static function metaForDefaultsEnabled(ClassMetadataBuilder $builder): void
22
    {
23 2
        MappingHelper::setSimpleBooleanFields(
24 2
            [DefaultsEnabledFieldInterface::PROP_DEFAULTS_ENABLED],
25 2
            $builder,
26 2
            DefaultsEnabledFieldInterface::DEFAULT_DEFAULTS_ENABLED
27
        );
28 2
    }
29
30
    /**
31
     * @return bool
32
     */
33 2
    public function isDefaultsEnabled(): bool
34
    {
35 2
        if (null === $this->defaultsEnabled) {
36
            return DefaultsEnabledFieldInterface::DEFAULT_DEFAULTS_ENABLED;
37
        }
38
39 2
        return $this->defaultsEnabled;
40
    }
41
42
    /**
43
     * @param bool|null $defaultsEnabled
44
     *
45
     * @return self
46
     */
47 2
    private function setDefaultsEnabled(bool $defaultsEnabled): self
48
    {
49 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

49
        $this->/** @scrutinizer ignore-call */ 
50
               updatePropertyValue(
Loading history...
50 2
            DefaultsEnabledFieldInterface::PROP_DEFAULTS_ENABLED,
51 2
            $defaultsEnabled
52
        );
53
54 2
        return $this;
55
    }
56
57 2
    private function initDefaultsEnabled(): void
58
    {
59 2
        $this->defaultsEnabled = DefaultsEnabledFieldInterface::DEFAULT_DEFAULTS_ENABLED;
60 2
    }
61
}
62