Exemple #1
0
 /**
  * Prepare variable to be used as nodes
  *
  * @param ILess_Environment $env
  * @param array $variables
  */
 protected function prepareVariables(ILess_Environment $env, array $variables)
 {
     // FIXME: flag to mark variables as prepared!
     $prepared = array();
     foreach ($variables as $name => $value) {
         // user provided node, no need to process it further
         if ($value instanceof ILess_Node) {
             $prepared[] = $value;
             continue;
         }
         // this is not an "real" variable
         if (!$value instanceof ILess_Variable) {
             $value = ILess_Variable::create($name, $value);
         }
         $prepared[] = $value->toNode();
     }
     if (count($prepared)) {
         $env->customVariables = new ILess_Node_Ruleset(array(), $prepared);
     }
 }
Exemple #2
0
 /**
  * @covers       toNode
  * @dataProvider getDataForTestCreateTest
  */
 public function testCreate($name, $value, $expectedObj)
 {
     $variable = ILess_Variable::create($name, $value);
     // convert to node
     $this->assertEquals($variable->toNode(), $expectedObj);
 }