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

HasAddressEmbeddableTrait::setAddressEmbeddable()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Traits\Geo;
4
5
use Doctrine\ORM\Events;
6
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
7
use EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Interfaces\Geo\HasAddressEmbeddableInterface;
8
use EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Interfaces\Objects\Geo\AddressEmbeddableInterface;
9
use EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Objects\Geo\AddressEmbeddable;
10
11
trait HasAddressEmbeddableTrait
12
{
13
    /**
14
     * @var AddressEmbeddableInterface
15
     */
16
    private $addressEmbeddable;
17
18
    /**
19
     * Called at construction time
20
     */
21 2
    private function initAddressEmbeddable(): void
22
    {
23 2
        $this->setAddressEmbeddable(new AddressEmbeddable(), false);
24 2
    }
25
26
    /**
27
     * @return AddressEmbeddableInterface
28
     */
29 2
    public function getAddressEmbeddable(): AddressEmbeddableInterface
30
    {
31 2
        return $this->addressEmbeddable;
32
    }
33
34
    /**
35
     * @param AddressEmbeddableInterface $address
36
     *
37
     * @param bool                       $notify
38
     *
39
     * @return $this
40
     * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
41
     */
42 2
    public function setAddressEmbeddable(AddressEmbeddableInterface $address, bool $notify = true): self
43
    {
44 2
        $this->addressEmbeddable = $address;
45 2
        $this->addressEmbeddable->setOwningEntity($this);
0 ignored issues
show
Bug introduced by
$this of type EdmondsCommerce\Doctrine...sAddressEmbeddableTrait is incompatible with the type EdmondsCommerce\Doctrine...TrackingPolicyInterface expected by parameter $entity of EdmondsCommerce\Doctrine...face::setOwningEntity(). ( Ignorable by Annotation )

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

45
        $this->addressEmbeddable->setOwningEntity(/** @scrutinizer ignore-type */ $this);
Loading history...
46 2
        if (true === $notify) {
47 1
            $this->notifyEmbeddablePrefixedProperties(HasAddressEmbeddableInterface::PROP_ADDRESS_EMBEDDABLE);
0 ignored issues
show
Bug introduced by
It seems like notifyEmbeddablePrefixedProperties() 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

47
            $this->/** @scrutinizer ignore-call */ 
48
                   notifyEmbeddablePrefixedProperties(HasAddressEmbeddableInterface::PROP_ADDRESS_EMBEDDABLE);
Loading history...
48
        }
49
50 2
        return $this;
51
    }
52
53
    public function postLoadSetOwningEntityOnAddressEmbeddable(): void
54
    {
55
        $this->addressEmbeddable->setOwningEntity($this);
0 ignored issues
show
Bug introduced by
$this of type EdmondsCommerce\Doctrine...sAddressEmbeddableTrait is incompatible with the type EdmondsCommerce\Doctrine...TrackingPolicyInterface expected by parameter $entity of EdmondsCommerce\Doctrine...face::setOwningEntity(). ( Ignorable by Annotation )

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

55
        $this->addressEmbeddable->setOwningEntity(/** @scrutinizer ignore-type */ $this);
Loading history...
56
    }
57
58
    /**
59
     * @param ClassMetadataBuilder $builder
60
     */
61 2
    protected static function metaForAddress(ClassMetadataBuilder $builder): void
62
    {
63 2
        $builder->addLifecycleEvent('postLoadSetOwningEntityOnAddressEmbeddable', Events::postLoad);
64 2
        $builder->createEmbedded(
65 2
            HasAddressEmbeddableInterface::PROP_ADDRESS_EMBEDDABLE,
66 2
            AddressEmbeddable::class
67
        )
68 2
                ->setColumnPrefix(
69 2
                    HasAddressEmbeddableInterface::COLUMN_PREFIX_ADDRESS
70
                )
71 2
                ->build();
72 2
    }
73
}
74