Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
Less_Tree_NameValue
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 4
56
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
 genCSS
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
20
 compile
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 makeImportant
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2declare( strict_types = 1 );
3
4/**
5 * A simple CSS name-value pair, e.g. `width: 100px;`
6 *
7 * In bootstrap, there are about 600-1000 simple name-value pairs (depending on
8 * how forgiving the match is) -vs- 6,020 dynamic rules (Less_Tree_Declaration).
9 *
10 * Using the name-value object can speed up bootstrap compilation slightly, but
11 * it breaks color keyword interpretation: `color: red` -> `color: #FF0000`.
12 *
13 * @private
14 */
15class Less_Tree_NameValue extends Less_Tree implements Less_Tree_HasValueProperty {
16
17    /** @var string */
18    public $name;
19    /** @var string */
20    public $value;
21    /** @var int|null */
22    public $index;
23    /** @var array|null */
24    public $currentFileInfo;
25    /** @var string */
26    public $important = '';
27
28    public function __construct( $name, $value = null, $index = null, $currentFileInfo = null ) {
29        $this->name = $name;
30        $this->value = $value;
31        $this->index = $index;
32        $this->currentFileInfo = $currentFileInfo;
33    }
34
35    public function genCSS( $output ) {
36        $output->add(
37            $this->name
38                . ( Less_Parser::$options['compress'] ? ':' : ': ' )
39                . $this->value
40                . $this->important
41                . ( ( ( Less_Environment::$lastRule && Less_Parser::$options['compress'] ) ) ? "" : ";" ),
42            $this->currentFileInfo, $this->index );
43    }
44
45    public function compile( $env ) {
46        return $this;
47    }
48
49    public function makeImportant() {
50        $new = new self( $this->name, $this->value, $this->index, $this->currentFileInfo );
51        $new->important = ' !important';
52        return $new;
53    }
54
55}