예제 #1
0
파일: ValueTest.php 프로젝트: mishal/iless
 /**
  * @covers generateCss
  */
 public function testGenerateCss()
 {
     $env = new Context();
     $output = new StandardOutput();
     $v = new ValueNode([new AnonymousNode('foobar')]);
     $v->generateCss($env, $output);
     $this->assertEquals('foobar', $output->toString());
 }
예제 #2
0
파일: MediaNode.php 프로젝트: jxav/iless
 /**
  * Compiles the node
  *
  * @param Context $context The context
  * @param array|null $arguments Array of arguments
  * @param boolean|null $important Important flag
  * @return RulesetNode
  */
 public function compile(Context $context, $arguments = null, $important = null)
 {
     if (!$context->mediaBlocks) {
         $context->mediaBlocks = [];
         $context->mediaPath = [];
     }
     $media = new MediaNode([], [], $this->index, $this->currentFileInfo);
     if ($this->debugInfo) {
         $this->rules[0]->debugInfo = $this->debugInfo;
         $media->debugInfo = $this->debugInfo;
     }
     $strictMathBypass = false;
     if (!$context->strictMath) {
         $strictMathBypass = true;
         $context->strictMath = true;
     }
     try {
         $media->features = $this->features->compile($context);
     } catch (Exception $e) {
         // empty on purpose
     }
     if ($strictMathBypass) {
         $context->strictMath = false;
     }
     $context->mediaPath[] = $media;
     $context->mediaBlocks[] = $media;
     $this->rules[0]->functionRegistry = isset($context->frames[0]) && $context->frames[0]->functionRegistry ? $context->frames[0]->functionRegistry->inherit() : $context->getFunctionRegistry()->inherit();
     array_unshift($context->frames, $this->rules[0]);
     $media->rules = [$this->rules[0]->compile($context)];
     array_shift($context->frames);
     array_pop($context->mediaPath);
     return count($context->mediaPath) == 0 ? $media->compileTop($context) : $media->compileNested($context);
 }