Example #1
0
 public function testIsSilent()
 {
     $env = new Context();
     $a = new CommentNode('// This is a comment', true);
     $b = new CommentNode('/* This is a comment */');
     $c = new CommentNode('/*! This is a comment */');
     $this->assertTrue($a->isSilent($env));
     $this->assertFalse($b->isSilent($env));
     // when compression is used
     $env->compress = true;
     $this->assertTrue($b->isSilent($env));
     $this->assertFalse($c->isSilent($env));
 }
Example #2
0
 /**
  * Visits a comment node
  *
  * @param CommentNode $node The node
  * @param VisitorArguments $arguments The arguments
  * @return CommentNode|null
  */
 public function visitComment(CommentNode $node, VisitorArguments $arguments)
 {
     if ($node->isSilent($this->getContext())) {
         return null;
     }
     return $node;
 }