Passed
Push — master ( 456cc4...4a5fe5 )
by Hector Luis
22:19
created

Base::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * Factory Pattern Base Class
6
 * @category    Ticaje
7
 * @package     Ticaje_Base
8
 * @author      Hector Luis Barrientos <[email protected]>
9
 */
10
11
namespace Ticaje\Base\Application\Factory;
12
13
use Ticaje\Base\Application\Service\ServiceLocatorInterface;
14
15
/**
16
 * Class Base
17
 * @package Ticaje\Base\Application\Factory
18
 */
19
abstract class Base implements FactoryInterface
20
{
21
    protected $serviceLocator;
22
23
    protected $instanceName;
24
25
    /**
26
     * Base constructor.
27
     * @param ServiceLocatorInterface $serviceLocator
28
     * @param string $instanceName
29
     */
30
    public function __construct(
31
        ServiceLocatorInterface $serviceLocator,
32
        string $instanceName
33
    ) {
34
        $this->serviceLocator = $serviceLocator;
35
        $this->instanceName = $instanceName;
36
    }
37
38
    /**
39
     * @inheritDoc
40
     */
41
    public function create(array $data = [])
42
    {
43
        return $this->serviceLocator->create($this->instanceName, $data);
44
    }
45
}
46