Completed
Push — master ( 5f5492...511737 )
by Arne
01:42
created

AbstractServiceFactoryContainer::getMap()   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 0
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
    public function register(string $name, callable $factoryClosure): AbstractServiceFactoryContainer
18
    {
19
        $this->map[$name] = $factoryClosure;
20
21
        return $this;
22
    }
23
24
    public function has(string $name): bool
25
    {
26
        return isset($this->map[$name]);
27
    }
28
}
29