Passed
Push — develop ( ec1e42...80559e )
by Brent
03:22
created

DynamicFactory::getRules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Stitcher;
4
5
abstract class DynamicFactory
6
{
7
    private $rules = [];
8
9 31
    public function setRule(string $class, callable $callback): DynamicFactory
10
    {
11 31
        $this->rules[$class] = $callback;
12
13 31
        return $this;
14
    }
15
16
    public function removeRule(string $class): DynamicFactory
17
    {
18
        if (isset($this->rules[$class])) {
19
            unset($this->rules[$class]);
20
        }
21
22
        return $this;
23
    }
24
25 25
    protected function getRules(): array
26
    {
27 25
        return $this->rules;
28
    }
29
}
30