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 (#75)
by joseph
14:44
created

AbstractEmbeddableObject::setOwningEntity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Objects;
4
5
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
6
use Doctrine\ORM\Mapping\ClassMetadata;
7
use EdmondsCommerce\DoctrineStaticMeta\Entity\Interfaces\ImplementNotifyChangeTrackingPolicyInterface;
8
9
abstract class AbstractEmbeddableObject
10
{
11
    /**
12
     * @var ImplementNotifyChangeTrackingPolicyInterface
13
     */
14
    protected $owningEntity;
15
16 4
    protected static function setEmbeddableAndGetBuilder(ClassMetadata $metadata): ClassMetadataBuilder
17
    {
18 4
        $builder = new ClassMetadataBuilder($metadata);
19 4
        $builder->setEmbeddable();
20
21 4
        return $builder;
22
    }
23
24
    abstract public function __toString(): string;
25
26 5
    public function setOwningEntity(ImplementNotifyChangeTrackingPolicyInterface $entity): void
27
    {
28 5
        $this->owningEntity = $entity;
29 5
    }
30
31
    /**
32
     * If we are attached to an owning Entity, then we need to use it to Notify the Unit of Work about changes
33
     *
34
     * If we are not attached, then do nothing. When we are attached, this should be triggered automatically
35
     *
36
     * @param null|string $propName
37
     * @param null|mixed  $oldValue
38
     * @param null|mixed  $newValue
39
     */
40 4
    protected function notifyEmbeddablePrefixedProperties(
41
        ?string $propName = null,
42
        $oldValue = null,
43
        $newValue = null
44
    ): void {
45 4
        if (null === $this->owningEntity) {
46
            return;
47
        }
48 4
        $this->owningEntity->notifyEmbeddablePrefixedProperties(
49 4
            $this->getPrefix(),
50 4
            $propName,
51 4
            $oldValue,
52 4
            $newValue
53
        );
54 4
    }
55
56
    abstract protected function getPrefix(): string;
57
}
58