Completed
Push — master ( aec287...fa4c41 )
by
unknown
20s queued 17s
created

Factory::injectConfigurationProvider()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.2559

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 3
cts 5
cp 0.6
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2.2559
1
<?php
2
namespace Aoe\Asdis\Domain\Model\Server;
3
4
use Aoe\Asdis\Domain\Model\Server;
5
use Aoe\Asdis\System\Configuration\Provider;
6
use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
7
8
/**
9
 * Factory for server objects.
10
 */
11
class Factory
12
{
13
    /**
14
     * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
15
     */
16
    private $objectManager;
17
18
    /**
19
     * @var string
20
     */
21
    private $protocolMarker;
22
23
    /**
24
     * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
25
     */
26 1
    public function injectObjectManager(ObjectManagerInterface $objectManager)
27
    {
28 1
        $this->objectManager = $objectManager;
29 1
    }
30
31
    /**
32
     * @param \Aoe\Asdis\System\Configuration\Provider $configurationProvider
33
     */
34 1
    public function injectConfigurationProvider(Provider $configurationProvider)
35
    {
36
        try {
37 1
            $this->protocolMarker = $configurationProvider->getServerProtocolMarker();
38
        } catch(Exception $e) {
0 ignored issues
show
Bug introduced by
The class Aoe\Asdis\Domain\Model\Server\Exception does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
39
            $this->protocolMarker = '';
40
        }
41 1
    }
42
43
    /**
44
     * @param string $identifier
45
     * @param string $domain
46
     * @param string $protocol
47
     * @return \Aoe\Asdis\Domain\Model\Server
48
     */
49 1
    public function createServer($identifier, $domain, $protocol)
50
    {
51
        /** @var \Aoe\Asdis\Domain\Model\Server $server */
52 1
        $server = $this->objectManager->get(Server::class);
53 1
        $server->setIdentifier($identifier);
54 1
        $server->setDomain($domain);
55 1
        $server->setProtocol($protocol);
56 1
        $server->setProtocolMarker($this->protocolMarker);
57 1
        return $server;
58
    }
59
}