1<?php 2 3/** 4 * Comment 5 * 6 * @package Less 7 * @subpackage tree 8 */ 9class Less_Tree_Comment extends Less_Tree { 10 11 public $value; 12 public $silent; 13 public $isReferenced; 14 public $currentFileInfo; 15 public $type = 'Comment'; 16 17 public function __construct( $value, $silent, $index = null, $currentFileInfo = null ) { 18 $this->value = $value; 19 $this->silent = !!$silent; 20 $this->currentFileInfo = $currentFileInfo; 21 } 22 23 /** 24 * @see Less_Tree::genCSS 25 */ 26 public function genCSS( $output ) { 27 // if( $this->debugInfo ){ 28 //$output->add( tree.debugInfo($env, $this), $this->currentFileInfo, $this->index); 29 //} 30 $output->add( trim( $this->value ) );// TODO shouldn't need to trim, we shouldn't grab the \n 31 } 32 33 public function toCSS() { 34 return Less_Parser::$options['compress'] ? '' : $this->value; 35 } 36 37 public function isSilent() { 38 $isReference = ( $this->currentFileInfo && isset( $this->currentFileInfo['reference'] ) && ( !isset( $this->isReferenced ) || !$this->isReferenced ) ); 39 $isCompressed = Less_Parser::$options['compress'] && !preg_match( '/^\/\*!/', $this->value ); 40 return $this->silent || $isReference || $isCompressed; 41 } 42 43 public function compile() { 44 return $this; 45 } 46 47 public function markReferenced() { 48 $this->isReferenced = true; 49 } 50 51} 52