CommunicationLocatorProxy   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
eloc 13
dl 0
loc 41
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A factory() 0 13 3
A getDirectory() 0 3 1
A facade() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Xervice\Core\Business\Model\Locator\Proxy\Communication;
5
6
7
use Xervice\Core\Business\Model\Facade\FacadeInterface;
8
use Xervice\Core\Business\Model\Factory\AbstractCommunicationFactory;
9
use Xervice\Core\Business\Model\Factory\FactoryInterface;
10
use Xervice\Core\Business\Model\Locator\Proxy\AbstractLocatorProxy;
11
12
class CommunicationLocatorProxy extends AbstractLocatorProxy implements CommunicationLocatorProxyInterface
13
{
14
    private const DIRECTORY = 'Communication';
15
16
    /**
17
     * @var \Xervice\Core\Business\Model\Factory\FactoryInterface
18
     */
19
    private $factory;
20
21
    /**
22
     * @return \Xervice\Core\Business\Model\Factory\FactoryInterface
23
     */
24 1
    public function factory(): FactoryInterface
25
    {
26 1
        if ($this->factory === null) {
27 1
            $class = $this->getServiceClass('CommunicationFactory', self::DIRECTORY)
28 1
                ?: AbstractCommunicationFactory::class;
29 1
            $this->factory = new $class(
30 1
                $this->config(),
31 1
                $this->container(),
32 1
                $this->facade()
33
            );
34
        }
35
36 1
        return $this->factory;
37
    }
38
39
    /**
40
     * @return \Xervice\Core\Business\Model\Facade\FacadeInterface
41
     */
42 2
    public function facade(): FacadeInterface
43
    {
44 2
        return $this->businessLocator()->facade();
45
    }
46
47
    /**
48
     * @return null|string
49
     */
50 1
    protected function getDirectory(): ?string
51
    {
52 1
        return self::DIRECTORY;
53
    }
54
}