Completed
Push — master ( 83bd2d...9517e2 )
by Arne
03:10
created

AbstractServiceFactoryContainer::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Archivr;
4
5
abstract class AbstractServiceFactoryContainer
6
{
7
    protected $map;
8
9
    /**
10
     * @param callable[] $map
11
     */
12
    public function __construct(array $map = [])
13
    {
14
        $this->map = $map;
15
    }
16
17
    /**
18
     * @return callable[]
19
     */
20
    public function getMap(): array
21
    {
22
        return $this->map;
23
    }
24
25
    public function register(string $name, callable $factoryClosure): AbstractServiceFactoryContainer
26
    {
27
        $this->map[$name] = $factoryClosure;
28
29
        return $this;
30
    }
31
32
    public function has(string $name): bool
33
    {
34
        return isset($this->map[$name]);
35
    }
36
}
37