AbstractFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 36
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A make() 0 3 1
A get() 0 3 1
1
<?php
2
3
namespace WebComplete\core\factory;
4
5
use WebComplete\core\utils\container\ContainerInterface;
6
7
/**
8
 * Class AbstractFactory
9
 */
10
abstract class AbstractFactory
11
{
12
13
    /**
14
     * @var ContainerInterface
15
     */
16
    private $container;
17
18
    /**
19
     * @param ContainerInterface $container
20
     */
21
    public function __construct(ContainerInterface $container)
22
    {
23
        $this->container = $container;
24
    }
25
26
    /**
27
     * Get an instance
28
     *
29
     * @param $name
30
     * @return mixed
31
     */
32
    protected function get($name)
33
    {
34
        return $this->container->get($name);
35
    }
36
37
    /**
38
     * Create an instance
39
     *
40
     * @param $name
41
     * @return mixed
42
     */
43
    protected function make($name)
44
    {
45
        return $this->container->make($name);
46
    }
47
}
48