BaseDecorator::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace League\CLImate\Decorator\Component;
4
5
abstract class BaseDecorator implements DecoratorInterface
6
{
7
    /**
8
     * An array of defaults for the decorator
9
     *
10
     * @var array $defaults;
11
     */
12
    protected $defaults = [];
13
14
    /**
15
     * An array of currently set codes for the decorator
16
     *
17
     * @var array $current;
18
     */
19
    protected $current  = [];
20
21 948
    public function __construct()
22
    {
23 948
        $this->defaults();
24 948
    }
25
26
    /**
27
     * Load up the defaults for this decorator
28
     */
29 948
    public function defaults()
30
    {
31 948
        foreach ($this->defaults as $name => $code) {
32 948
            $this->add($name, $code);
33 948
        }
34 948
    }
35
36
    /**
37
     * Reset the currently set decorator
38
     */
39 568
    public function reset()
40
    {
41 568
        $this->current = [];
42 568
    }
43
44
    /**
45
     * Retrieve the currently set codes for the decorator
46
     *
47
     * @return array
48
     */
49 576
    public function current()
50
    {
51 576
        return $this->current;
52
    }
53
}
54