Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
13 / 13 |
|
100.00% |
8 / 8 |
CRAP | |
100.00% |
1 / 1 |
Less_Tree_Anonymous | |
100.00% |
13 / 13 |
|
100.00% |
8 / 8 |
12 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |||
compile | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
compare | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
3 | |||
isRulesetLike | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
genCSS | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
toCSS | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
markReferenced | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getIsReferenced | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
3 |
1 | <?php |
2 | /** |
3 | * @private |
4 | * @see less-2.5.3.js#Anonymous.prototype |
5 | */ |
6 | class Less_Tree_Anonymous extends Less_Tree implements Less_Tree_HasValueProperty { |
7 | public $value; |
8 | public $quote; |
9 | public $index; |
10 | public $mapLines; |
11 | public $currentFileInfo; |
12 | /** @var bool */ |
13 | public $rulesetLike; |
14 | public $isReferenced; |
15 | |
16 | /** |
17 | * @param string $value |
18 | * @param int|null $index |
19 | * @param array|null $currentFileInfo |
20 | * @param bool|null $mapLines |
21 | * @param bool $rulesetLike |
22 | * @param bool $referenced |
23 | */ |
24 | public function __construct( $value, $index = null, $currentFileInfo = null, $mapLines = null, $rulesetLike = false, $referenced = false ) { |
25 | $this->value = $value; |
26 | $this->index = $index; |
27 | $this->mapLines = $mapLines; |
28 | $this->currentFileInfo = $currentFileInfo; |
29 | $this->rulesetLike = $rulesetLike; |
30 | $this->isReferenced = $referenced; |
31 | } |
32 | |
33 | public function compile( $env ) { |
34 | return new self( $this->value, $this->index, $this->currentFileInfo, $this->mapLines, $this->rulesetLike, $this->isReferenced ); |
35 | } |
36 | |
37 | /** |
38 | * @param Less_Tree|mixed $x |
39 | * @return int|null |
40 | * @see less-2.5.3.js#Anonymous.prototype.compare |
41 | */ |
42 | public function compare( $x ) { |
43 | return ( is_object( $x ) && $this->toCSS() === $x->toCSS() ) ? 0 : null; |
44 | } |
45 | |
46 | public function isRulesetLike() { |
47 | return $this->rulesetLike; |
48 | } |
49 | |
50 | /** |
51 | * @see Less_Tree::genCSS |
52 | */ |
53 | public function genCSS( $output ) { |
54 | $output->add( $this->value, $this->currentFileInfo, $this->index, $this->mapLines ); |
55 | } |
56 | |
57 | public function toCSS() { |
58 | return $this->value; |
59 | } |
60 | |
61 | public function markReferenced() { |
62 | $this->isReferenced = true; |
63 | } |
64 | |
65 | public function getIsReferenced() { |
66 | return !isset( $this->currentFileInfo['reference'] ) || !$this->currentFileInfo['reference'] || $this->isReferenced; |
67 | } |
68 | } |