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 (#153)
by joseph
22:07
created

setSkeletonEmbeddable()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 2
dl 0
loc 11
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace TemplateNamespace\Entity\Embeddable\Traits\CatName;
4
5
use Doctrine\ORM\Events;
6
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
7
use TemplateNamespace\Entity\Embeddable\Interfaces\CatName\HasSkeletonEmbeddableInterface;
8
use TemplateNamespace\Entity\Embeddable\Interfaces\Objects\CatName\SkeletonEmbeddableInterface;
9
use TemplateNamespace\Entity\Embeddable\Objects\CatName\SkeletonEmbeddable;
10
11
trait HasSkeletonEmbeddableTrait
12
{
13
    /**
14
     * @var SkeletonEmbeddableInterface
15
     */
16
    private $skeletonEmbeddable;
17
18
    /**
19
     * @param ClassMetadataBuilder $builder
20
     */
21
    protected static function metaForSkeletonEmbeddable(ClassMetadataBuilder $builder): void
22
    {
23
        $builder->addLifecycleEvent(
24
            'postLoadSetOwningEntityOnSkeletonEmbeddable',
25
            Events::postLoad
26
        );
27
        $builder->createEmbedded(
28
            HasSkeletonEmbeddableInterface::PROP_SKELETON_EMBEDDABLE,
29
            SkeletonEmbeddable::class
30
        )
31
                ->setColumnPrefix(
32
                    HasSkeletonEmbeddableInterface::COLUMN_PREFIX_SKELETON
33
                )
34
                ->build();
35
    }
36
37
    /**
38
     * @return mixed
39
     */
40
    public function getSkeletonEmbeddable(): SkeletonEmbeddableInterface
41
    {
42
        return $this->skeletonEmbeddable;
43
    }
44
45
    public function postLoadSetOwningEntityOnSkeletonEmbeddable(): void
46
    {
47
        $this->skeletonEmbeddable->setOwningEntity($this);
0 ignored issues
show
Bug introduced by
$this of type TemplateNamespace\Entity...SkeletonEmbeddableTrait 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

47
        $this->skeletonEmbeddable->setOwningEntity(/** @scrutinizer ignore-type */ $this);
Loading history...
48
    }
49
50
    /**
51
     * Called at construction time
52
     */
53
    private function initSkeletonEmbeddable(): void
54
    {
55
        $this->setSkeletonEmbeddable(
56
            new SkeletonEmbeddable(
57
                SkeletonEmbeddableInterface::DEFAULT_PROPERTY_ONE,
58
                SkeletonEmbeddableInterface::DEFAULT_PROPERTY_TWO
59
            ),
60
            false
61
        );
62
    }
63
64
    /**
65
     * @param SkeletonEmbeddable $skeletonEmbeddable
66
     *
67
     * @param bool               $notify
68
     *
69
     * @return $this
70
     * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
71
     */
72
    private function setSkeletonEmbeddable(SkeletonEmbeddable $skeletonEmbeddable, bool $notify = true): self
73
    {
74
        $this->skeletonEmbeddable = $skeletonEmbeddable;
75
        $this->skeletonEmbeddable->setOwningEntity($this);
0 ignored issues
show
Bug introduced by
$this of type TemplateNamespace\Entity...SkeletonEmbeddableTrait is incompatible with the type EdmondsCommerce\Doctrine...TrackingPolicyInterface expected by parameter $entity of EdmondsCommerce\Doctrine...ject::setOwningEntity(). ( Ignorable by Annotation )

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

75
        $this->skeletonEmbeddable->setOwningEntity(/** @scrutinizer ignore-type */ $this);
Loading history...
76
        if (true === $notify) {
77
            $this->notifyEmbeddablePrefixedProperties(
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

77
            $this->/** @scrutinizer ignore-call */ 
78
                   notifyEmbeddablePrefixedProperties(
Loading history...
78
                HasSkeletonEmbeddableInterface::PROP_SKELETON_EMBEDDABLE
79
            );
80
        }
81
82
        return $this;
83
    }
84
}