Completed
Push — master ( 41a25f...269818 )
by Mike
02:08
created

CommunicationLocatorProxy::facade()   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
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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) ?: AbstractCommunicationFactory::class;
28 1
            $this->factory = new $class(
29 1
                $this->config(),
30 1
                $this->container()
31
            );
32
        }
33
34 1
        return $this->factory;
35
    }
36
37
    /**
38
     * @return \Xervice\Core\Business\Model\Facade\FacadeInterface
39
     */
40 1
    public function facade(): FacadeInterface
41
    {
42 1
        return $this->businessLocator()->facade();
43
    }
44
45
    /**
46
     * @return null|string
47
     */
48 1
    protected function getDirectory(): ?string
49
    {
50 1
        return self::DIRECTORY;
51
    }
52
}