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   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 93.75%

Importance

Changes 0
Metric Value
wmc 4
eloc 13
dl 0
loc 48
ccs 15
cts 16
cp 0.9375
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setOwningEntity() 0 3 1
A notifyEmbeddablePrefixedProperties() 0 13 2
A setEmbeddableAndGetBuilder() 0 6 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