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

47 lines
814 B
PHP
Raw Normal View History

2021-04-08 08:08:59 +00:00
<?php
/**
2023-02-27 04:39:19 +00:00
* @private
2021-04-08 08:08:59 +00:00
*/
2023-02-27 04:39:19 +00:00
class Less_Tree_Value extends Less_Tree {
2021-04-08 08:08:59 +00:00
public $type = 'Value';
public $value;
2023-02-27 04:39:19 +00:00
/**
* @param array<Less_Tree> $value
*/
public function __construct( $value ) {
2021-04-08 08:08:59 +00:00
$this->value = $value;
}
2023-02-27 04:39:19 +00:00
public function accept( $visitor ) {
$this->value = $visitor->visitArray( $this->value );
2021-04-08 08:08:59 +00:00
}
2023-02-27 04:39:19 +00:00
public function compile( $env ) {
$ret = [];
2021-04-08 08:08:59 +00:00
$i = 0;
2023-02-27 04:39:19 +00:00
foreach ( $this->value as $i => $v ) {
$ret[] = $v->compile( $env );
2021-04-08 08:08:59 +00:00
}
2023-02-27 04:39:19 +00:00
if ( $i > 0 ) {
return new Less_Tree_Value( $ret );
2021-04-08 08:08:59 +00:00
}
return $ret[0];
}
2023-02-27 04:39:19 +00:00
/**
* @see Less_Tree::genCSS
*/
function genCSS( $output ) {
$len = count( $this->value );
for ( $i = 0; $i < $len; $i++ ) {
2021-04-08 08:08:59 +00:00
$this->value[$i]->genCSS( $output );
2023-02-27 04:39:19 +00:00
if ( $i + 1 < $len ) {
2021-04-08 08:08:59 +00:00
$output->add( Less_Environment::$_outputMap[','] );
}
}
}
}