HTML::apply()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 14
ccs 6
cts 6
cp 1
rs 10
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
namespace Bavix\Flow\Minify;
4
5
class HTML
6
{
7
8
    /**
9
     * @var string
10
     */
11
    protected $buffer;
12
13
    /**
14
     * @var string[]
15
     */
16
    protected $extends;
17
18
    /**
19
     * HTML constructor.
20
     *
21
     * @param string $buffer
22
     * @param array $extends
23
     */
24 3
    public function __construct(string $buffer, array $extends)
25
    {
26 3
        $this->buffer  = $buffer;
27 3
        $this->extends = $extends;
28 3
    }
29
30
    /**
31
     * @return string
32
     */
33 3
    public function apply(): string
34
    {
35 3
        foreach ($this->extends as $extend)
36
        {
37
            /**
38
             * @var Extension $object
39
             */
40 3
            $object = new $extend($this->buffer);
41 3
            $object->apply();
42
43 3
            $this->buffer = (string)$object;
44
        }
45
46 3
        return $this->buffer;
47
    }
48
49
}
50