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.

AbstractEmbeddableCreator::configurePipeline()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
ccs 0
cts 3
cp 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\Src\Entity\Embeddable;
6
7
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\AbstractCreator;
8
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\Process\ReplaceNameProcess;
9
use InvalidArgumentException;
10
use RuntimeException;
11
12
abstract class AbstractEmbeddableCreator extends AbstractCreator
13
{
14
    /**
15
     * @var string|null
16
     */
17
    protected $catName;
18
19
    /**
20
     * @var string|null
21
     */
22
    protected $name;
23
24
25
    public function createTargetFileObject(string $newObjectFqn = null): AbstractCreator
26
    {
27
        if (null !== $newObjectFqn) {
28
            throw new InvalidArgumentException('You do not pass a new object FQN into this creator');
29
        }
30
        if ('' === (string)$this->catName) {
31
            throw new RuntimeException('You must call setCatName before running this creator');
32
        }
33
        if ('' === (string)$this->name) {
34
            throw new RuntimeException('You must call setName before running this creator');
35
        }
36
        if ('' === (string)$this->projectRootNamespace) {
37
            throw new RuntimeException('You must call setProjectRootNamespace before running this creator');
38
        }
39
40
        return parent::createTargetFileObject($this->getNewObjectFqn());
41
    }
42
43
    abstract protected function getNewObjectFqn(): string;
44
45
    /**
46
     * @param string $catName
47
     *
48
     * @return AbstractEmbeddableCreator
49
     */
50
    public function setCatName(string $catName): AbstractEmbeddableCreator
51
    {
52
        $this->catName = $catName;
53
54
        return $this;
55
    }
56
57
    /**
58
     * @param string $name
59
     *
60
     * @return AbstractEmbeddableCreator
61
     */
62
    public function setName(string $name): AbstractEmbeddableCreator
63
    {
64
        $this->name = $name;
65
66
        return $this;
67
    }
68
69
    protected function configurePipeline(): void
70
    {
71
        parent::configurePipeline();
72
        $this->registerReplaceSkeletonEmbeddable();
73
    }
74
75
    private function registerReplaceSkeletonEmbeddable(): void
76
    {
77
        $replaceName = new ReplaceNameProcess();
78
        $replaceName->setArgs(
79
            'CatName',
80
            $this->catName
0 ignored issues
show
Bug introduced by
It seems like $this->catName can also be of type null; however, parameter $newObjectBaseName of EdmondsCommerce\Doctrine...eNameProcess::setArgs() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

80
            /** @scrutinizer ignore-type */ $this->catName
Loading history...
81
        );
82
        $this->pipeline->register($replaceName);
83
        $replaceName = new ReplaceNameProcess();
84
        $replaceName->setArgs(
85
            'Skeleton',
86
            $this->name
87
        );
88
        $this->pipeline->register($replaceName);
89
    }
90
}
91