Debian Codegraph @

vendor/wikimedia/less.php/lib/Less/Tree/Value.php

raw
1 <?php
2 /**
3 * @private
4 */
5 class Less_Tree_Value extends Less_Tree implements Less_Tree_HasValueProperty {
6
7 /** @var Less_Tree[] */
8 public $value;
9 /** @var int|null */
10 public $index;
11 /** @var array */
12 public $currentFileInfo;
13
14 /**
15 * @param array<Less_Tree> $value
16 */
17 public function __construct( $value, $index = null ) {
18 $this->value = $value;
19 $this->index = $index;
20 }
21
22 public function accept( $visitor ) {
23 $this->value = $visitor->visitArray( $this->value );
24 }
25
26 public function compile( $env ) {
27 $ret = [];
28 $i = 0;
29 foreach ( $this->value as $i => $v ) {
30 $ret[] = $v->compile( $env );
31 }
32 if ( $i > 0 ) {
33 return new self( $ret );
34 }
35 return $ret[0];
36 }
37
38 /**
39 * @see less-2.5.3.js#Value.prototype.genCSS
40 */
41 public function genCSS( $output ) {
42 $len = count( $this->value );
43 for ( $i = 0; $i < $len; $i++ ) {
44 $this->value[$i]->genCSS( $output );
45 if ( $i + 1 < $len ) {
46 $output->add( Less_Parser::$options['compress'] ? ',' : ', ' );
47 }
48 }
49 }
50
51 }