Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
66.67% |
2 / 3 |
|
66.67% |
2 / 3 |
CRAP | |
0.00% |
0 / 1 |
Less_Output | |
66.67% |
2 / 3 |
|
66.67% |
2 / 3 |
3.33 | |
0.00% |
0 / 1 |
add | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
isEmpty | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
toString | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | /** |
3 | * Parser output |
4 | * |
5 | * @private |
6 | */ |
7 | class Less_Output { |
8 | |
9 | /** |
10 | * Output holder |
11 | * |
12 | * @var string[] |
13 | */ |
14 | protected $strs = []; |
15 | |
16 | /** |
17 | * Adds a chunk to the stack |
18 | * |
19 | * @param string $chunk The chunk to output |
20 | * @param array|null $fileInfo The file information |
21 | * @param int $index The index |
22 | * @param bool|null $mapLines |
23 | */ |
24 | public function add( $chunk, $fileInfo = null, $index = 0, $mapLines = null ) { |
25 | $this->strs[] = $chunk; |
26 | } |
27 | |
28 | /** |
29 | * Is the output empty? |
30 | * |
31 | * @return bool |
32 | */ |
33 | public function isEmpty() { |
34 | return count( $this->strs ) === 0; |
35 | } |
36 | |
37 | /** |
38 | * Converts the output to string |
39 | * |
40 | * @return string |
41 | */ |
42 | public function toString() { |
43 | return implode( '', $this->strs ); |
44 | } |
45 | |
46 | } |