Passed
Pull Request — master (#16)
by
unknown
12:51
created

ServerRepository::injectObjectManager()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Aoe\Asdis\Domain\Repository;
4
5
use Aoe\Asdis\Domain\Model\Page;
6
use Aoe\Asdis\Domain\Model\Server\Collection;
7
use Aoe\Asdis\Domain\Model\Server\Factory;
8
use Aoe\Asdis\System\Configuration\Provider;
9
10
/**
11
 * Repository for server objects.
12
 */
13
class ServerRepository
14
{
15
    private ?Provider $configurationProvider = null;
16
17
    private ?Factory $serverFactory = null;
18
19
    public function injectConfigurationProvider(Provider $configurationProvider): void
20
    {
21
        $this->configurationProvider = $configurationProvider;
22
    }
23
24
    public function injectServerFactory(Factory $serverFactory): void
25
    {
26
        $this->serverFactory = $serverFactory;
27
    }
28
29
    public function findAllByPage(Page $page): Collection
0 ignored issues
show
Unused Code introduced by
The parameter $page is not used and could be removed. ( Ignorable by Annotation )

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

29
    public function findAllByPage(/** @scrutinizer ignore-unused */ Page $page): Collection

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
30
    {
31 1
        $servers = new Collection();
32
        $serverDefinitions = $this->configurationProvider->getServerDefinitions();
0 ignored issues
show
Bug introduced by
The method getServerDefinitions() does not exist on null. ( Ignorable by Annotation )

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

32
        /** @scrutinizer ignore-call */ 
33
        $serverDefinitions = $this->configurationProvider->getServerDefinitions();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
33 1
        foreach ($serverDefinitions as $serverDefinition) {
34 1
            $servers->append($this->serverFactory->createServer(
0 ignored issues
show
Bug introduced by
The method createServer() does not exist on null. ( Ignorable by Annotation )

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

34
            $servers->append($this->serverFactory->/** @scrutinizer ignore-call */ createServer(

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
35
                $serverDefinition['identifier'],
36
                $serverDefinition['domain'],
37
                $serverDefinition['protocol']
38
            ));
39 1
        }
40
        return $servers;
41 1
    }
42
}
43