Completed
Push — master ( c8e320...41a25f )
by Mike
03:33
created

AbstractBusinessFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 40
c 0
b 0
f 0
ccs 4
cts 8
cp 0.5
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getConfig() 0 3 1
A getDependency() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Xervice\Core\Business\Model\Factory;
5
6
7
use Xervice\Core\Business\Model\Config\ConfigInterface;
8
use Xervice\Core\Business\Model\Dependency\DependencyContainerInterface;
9
10
class AbstractBusinessFactory implements FactoryInterface
11
{
12
    /**
13
     * @var \Xervice\Core\Business\Model\Config\ConfigInterface
14
     */
15
    protected $config;
16
17
    /**
18
     * @var \Xervice\Core\Business\Model\Dependency\DependencyContainerInterface
19
     */
20
    protected $container;
21
22
    /**
23
     * AbstractBusinessFactory constructor.
24
     *
25
     * @param \Xervice\Core\Business\Model\Config\ConfigInterface $config
26
     * @param \Xervice\Core\Business\Model\Dependency\DependencyContainerInterface $container
27
     */
28 2
    public function __construct(ConfigInterface $config, DependencyContainerInterface $container)
29
    {
30 2
        $this->config = $config;
31 2
        $this->container = $container;
32 2
    }
33
34
    /**
35
     * @return \Xervice\Core\Business\Model\Config\ConfigInterface
36
     */
37
    protected function getConfig(): ConfigInterface
38
    {
39
        return $this->config;
40
    }
41
42
    /**
43
     * @param string $key
44
     *
45
     * @return mixed
46
     */
47
    protected function getDependency(string $key)
48
    {
49
        return $this->container->get($key);
50
    }
51
}