X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/vendor/oyejorge/less.php/lib/Less/Tree/Operation.php diff --git a/vendor/oyejorge/less.php/lib/Less/Tree/Operation.php b/vendor/oyejorge/less.php/lib/Less/Tree/Operation.php new file mode 100644 index 00000000..e69e0da6 --- /dev/null +++ b/vendor/oyejorge/less.php/lib/Less/Tree/Operation.php @@ -0,0 +1,70 @@ +op = trim($op); + $this->operands = $operands; + $this->isSpaced = $isSpaced; + } + + public function accept($visitor) { + $this->operands = $visitor->visitArray($this->operands); + } + + public function compile($env){ + $a = $this->operands[0]->compile($env); + $b = $this->operands[1]->compile($env); + + + if( Less_Environment::isMathOn() ){ + + if( $a instanceof Less_Tree_Dimension && $b instanceof Less_Tree_Color ){ + $a = $a->toColor(); + + }elseif( $b instanceof Less_Tree_Dimension && $a instanceof Less_Tree_Color ){ + $b = $b->toColor(); + + } + + if( !method_exists($a,'operate') ){ + throw new Less_Exception_Compiler("Operation on an invalid type"); + } + + return $a->operate( $this->op, $b); + } + + return new Less_Tree_Operation($this->op, array($a, $b), $this->isSpaced ); + } + + + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ){ + $this->operands[0]->genCSS( $output ); + if( $this->isSpaced ){ + $output->add( " " ); + } + $output->add( $this->op ); + if( $this->isSpaced ){ + $output->add( ' ' ); + } + $this->operands[1]->genCSS( $output ); + } + +}