Beispiel #1
0
 /**
  * @see ILess_Node
  */
 public function compile(ILess_Environment $env, $arguments = null, $important = null)
 {
     $media = new ILess_Node_Media(array(), array(), $this->index, $this->currentFileInfo);
     if ($this->debugInfo) {
         $this->rules[0]->debugInfo = $this->debugInfo;
         $media->debugInfo = $this->debugInfo;
     }
     $strictMathBypass = false;
     if (!$env->strictMath) {
         $strictMathBypass = true;
         $env->strictMath = true;
     }
     try {
         $media->features = $this->features->compile($env);
     } catch (Exception $e) {
         // empty on purpose
     }
     if ($strictMathBypass) {
         $env->strictMath = false;
     }
     $env->mediaPath[] = $media;
     $env->mediaBlocks[] = $media;
     array_unshift($env->frames, $this->rules[0]);
     $media->rules = array($this->rules[0]->compile($env));
     array_shift($env->frames);
     array_pop($env->mediaPath);
     return count($env->mediaPath) == 0 ? $media->compileTop($env) : $media->compileNested($env);
 }
Beispiel #2
0
 /**
  * @covers getType
  */
 public function testGetType()
 {
     $d = new ILess_Node_Media(array('black'));
     $this->assertEquals('Media', $d->getType());
 }
Beispiel #3
0
 /**
  * Visits a media node
  *
  * @param ILess_Node_Media $node The node
  * @param ILess_Visitor_Arguments $arguments The arguments
  * @return ILess_Node_Media
  */
 public function visitMedia(ILess_Node_Media $node, ILess_Visitor_Arguments $arguments)
 {
     $node->accept($this);
     $arguments->visitDeeper = false;
     if (!count($node->rules)) {
         return array();
     }
     return $node;
 }