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
Push — master ( 37eca9...fbc101 )
by joseph
236:04 queued 233:05
created

HasFullNameEmbeddableTrait   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Test Coverage

Coverage 89.29%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 22
c 2
b 0
f 0
dl 0
loc 70
rs 10
ccs 25
cts 28
cp 0.8929
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A metaForFullNameEmbeddable() 0 14 1
A getFullNameEmbeddable() 0 3 1
A initFullNameEmbeddable() 0 5 1
A setFullNameEmbeddable() 0 11 2
A postLoadSetOwningEntityOnFullNameEmbeddable() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Traits\Identity;
4
5
use Doctrine\ORM\Events;
6
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
7
use EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Interfaces\Identity\HasFullNameEmbeddableInterface;
8
use EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Interfaces\Objects\Identity\FullNameEmbeddableInterface;
9
use EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Objects\Identity\FullNameEmbeddable;
10
11
trait HasFullNameEmbeddableTrait
12
{
13
    /**
14
     * @var FullNameEmbeddableInterface
15
     */
16
    private $fullNameEmbeddable;
17
18
    /**
19
     * @param ClassMetadataBuilder $builder
20
     */
21 1
    protected static function metaForFullNameEmbeddable(ClassMetadataBuilder $builder): void
22
    {
23 1
        $builder->addLifecycleEvent(
24 1
            'postLoadSetOwningEntityOnFullNameEmbeddable',
25 1
            Events::postLoad
26
        );
27 1
        $builder->createEmbedded(
28 1
            HasFullNameEmbeddableInterface::PROP_FULL_NAME_EMBEDDABLE,
29 1
            FullNameEmbeddable::class
30
        )
31 1
                ->setColumnPrefix(
32 1
                    HasFullNameEmbeddableInterface::COLUMN_PREFIX_FULL_NAME
33
                )
34 1
                ->build();
35 1
    }
36
37
    /**
38
     * @return mixed
39
     */
40 1
    public function getFullNameEmbeddable(): FullNameEmbeddableInterface
41
    {
42 1
        return $this->fullNameEmbeddable;
43
    }
44
45
    public function postLoadSetOwningEntityOnFullNameEmbeddable(): void
46
    {
47
        $this->fullNameEmbeddable->setOwningEntity($this);
0 ignored issues
show
Bug introduced by
$this of type EdmondsCommerce\Doctrine...FullNameEmbeddableTrait 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->fullNameEmbeddable->setOwningEntity(/** @scrutinizer ignore-type */ $this);
Loading history...
48
    }
49
50
    /**
51
     * Called at construction time
52
     * @SuppressWarnings(PHPMD.StaticAccess)
53
     */
54 1
    private function initFullNameEmbeddable(): void
55
    {
56 1
        $this->setFullNameEmbeddable(
57 1
            FullNameEmbeddable::create(FullNameEmbeddable::DEFAULTS),
58 1
            false
59
        );
60 1
    }
61
62
    /**
63
     * @param FullNameEmbeddableInterface $fullNameEmbeddable
64
     *
65
     * @param bool                        $notify
66
     *
67
     * @return $this
68
     * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
69
     */
70 1
    private function setFullNameEmbeddable(FullNameEmbeddableInterface $fullNameEmbeddable, bool $notify = true): self
71
    {
72 1
        $this->fullNameEmbeddable = $fullNameEmbeddable;
73 1
        $this->fullNameEmbeddable->setOwningEntity($this);
0 ignored issues
show
Bug introduced by
$this of type EdmondsCommerce\Doctrine...FullNameEmbeddableTrait 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

73
        $this->fullNameEmbeddable->setOwningEntity(/** @scrutinizer ignore-type */ $this);
Loading history...
74 1
        if (true === $notify) {
75 1
            $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

75
            $this->/** @scrutinizer ignore-call */ 
76
                   notifyEmbeddablePrefixedProperties(
Loading history...
76 1
                HasFullNameEmbeddableInterface::PROP_FULL_NAME_EMBEDDABLE
77
            );
78
        }
79
80 1
        return $this;
81
    }
82
}
83