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.
Passed
Pull Request — master (#153)
by joseph
15:17
created

AbstractEmbeddableCreator   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 78
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 28
dl 0
loc 78
rs 10
c 0
b 0
f 0
ccs 0
cts 45
cp 0
wmc 9

5 Methods

Rating   Name   Duplication   Size   Complexity  
A createTargetFileObject() 0 16 5
A configurePipeline() 0 4 1
A setCatName() 0 5 1
A registerReplaceSkeletonEmbeddable() 0 14 1
A setName() 0 5 1
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\Src\Entity\Embeddable;
4
5
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\AbstractCreator;
6
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\Process\ReplaceNameProcess;
7
8
abstract class AbstractEmbeddableCreator extends AbstractCreator
9
{
10
    /**
11
     * @var string|null
12
     */
13
    protected $catName;
14
15
    /**
16
     * @var string|null
17
     */
18
    protected $name;
19
20
21
    public function createTargetFileObject(string $newObjectFqn = null): AbstractCreator
22
    {
23
        if (null !== $newObjectFqn) {
24
            throw new \InvalidArgumentException('You do not pass a new object FQN into this creator');
25
        }
26
        if ('' === (string)$this->catName) {
27
            throw new \RuntimeException('You must call setCatName before running this creator');
28
        }
29
        if ('' === (string)$this->name) {
30
            throw new \RuntimeException('You must call setName before running this creator');
31
        }
32
        if ('' === (string)$this->projectRootNamespace) {
33
            throw new \RuntimeException('You must call setProjectRootNamespace before running this creator');
34
        }
35
36
        return parent::createTargetFileObject($this->getNewObjectFqn());
37
    }
38
39
    abstract protected function getNewObjectFqn(): string;
40
41
    /**
42
     * @param string $catName
43
     *
44
     * @return AbstractEmbeddableCreator
45
     */
46
    public function setCatName(string $catName): AbstractEmbeddableCreator
47
    {
48
        $this->catName = $catName;
49
50
        return $this;
51
    }
52
53
    /**
54
     * @param string $name
55
     *
56
     * @return AbstractEmbeddableCreator
57
     */
58
    public function setName(string $name): AbstractEmbeddableCreator
59
    {
60
        $this->name = $name;
61
62
        return $this;
63
    }
64
65
    protected function configurePipeline(): void
66
    {
67
        parent::configurePipeline();
68
        $this->registerReplaceSkeletonEmbeddable();
69
70
    }
71
72
    private function registerReplaceSkeletonEmbeddable(): void
73
    {
74
        $replaceName = new ReplaceNameProcess();
75
        $replaceName->setArgs(
76
            'CatName',
77
            $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

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