Debian Codegraph @

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

raw
1 <?php
2 /**
3 * @private
4 * @see less-2.5.3.js#Alpha.prototype
5 */
6 class Less_Tree_Alpha extends Less_Tree implements Less_Tree_HasValueProperty {
7 /** @var string|Less_Tree */
8 public $value;
9
10 /**
11 * @param string|Less_Tree $val This receives string or Less_Tree_Variable
12 * from Less_Parser. In compile(), Less_Tree_Variable is replaced with a
13 * different node (e.g. Less_Tree_Quoted).
14 */
15 public function __construct( $val ) {
16 $this->value = $val;
17 }
18
19 public function accept( $visitor ) {
20 if ( $this->value instanceof Less_Tree ) {
21 $this->value = $visitor->visitObj( $this->value );
22 }
23 }
24
25 public function compile( $env ) {
26 if ( $this->value instanceof Less_Tree ) {
27 return new self( $this->value->compile( $env ) );
28 }
29
30 return $this;
31 }
32
33 public function genCSS( $output ) {
34 $output->add( "alpha(opacity=" );
35
36 if ( $this->value instanceof Less_Tree ) {
37 $this->value->genCSS( $output );
38 } else {
39 $output->add( $this->value );
40 }
41
42 $output->add( ')' );
43 }
44 }