Ejemplo n.º 1
0
 /**
  * Constructor.
  *
  * @param string $value The comment value
  * @param bool $isLineComment
  */
 public function __construct($value, $isLineComment = false, $index = 0, FileInfo $currentFileInfo = null)
 {
     parent::__construct($value);
     $this->isLineComment = (bool) $isLineComment;
     $this->index = $index;
     $this->currentFileInfo = $currentFileInfo;
 }
Ejemplo n.º 2
0
 /**
  * Constructor.
  *
  * @param string $name The name
  * @param array|string $value The value
  * @param RulesetNode|null|array $rules
  * @param int $index The index
  * @param FileInfo $currentFileInfo Current file info
  * @param DebugInfo $debugInfo The debug information
  * @param bool $isReferenced Is referenced?
  * @param bool $isRooted Is rooted?
  */
 public function __construct($name, $value, $rules = null, $index = 0, FileInfo $currentFileInfo = null, DebugInfo $debugInfo = null, $isReferenced = false, $isRooted = false)
 {
     $this->name = $name;
     parent::__construct($value);
     if (null !== $rules) {
         if (is_array($rules)) {
             $this->rules = $rules;
         } else {
             $this->rules = [$rules];
             $selectors = new SelectorNode([], [], null, $index, $currentFileInfo);
             $this->rules[0]->selectors = $selectors->createEmptySelectors();
         }
         for ($i = 0; $i < count($this->rules); ++$i) {
             $this->rules[$i]->allowImports = true;
         }
     } else {
         // null
         $this->rules = $rules;
     }
     $this->index = $index;
     $this->currentFileInfo = $currentFileInfo;
     $this->debugInfo = $debugInfo;
     $this->isReferenced = $isReferenced;
     $this->isRooted = $isRooted;
 }
Ejemplo n.º 3
0
 /**
  * Constructor
  *
  * @param Node $value
  * @param int $index
  * @param FileInfo $currentFileInfo
  * @param bool $isCompiled
  */
 public function __construct(Node $value, $index = 0, FileInfo $currentFileInfo = null, $isCompiled = false)
 {
     parent::__construct($value);
     $this->index = $index;
     $this->currentFileInfo = $currentFileInfo;
     $this->isCompiled = $isCompiled;
 }
Ejemplo n.º 4
0
 /**
  * Constructor
  *
  * @param string $string The quote
  * @param string $content The string
  * @param boolean $escaped Is the string escaped?
  * @param integer $index Current index
  * @param FileInfo $currentFileInfo The current file info
  */
 public function __construct($string, $content = '', $escaped = false, $index = 0, FileInfo $currentFileInfo = null)
 {
     parent::__construct($content);
     $this->escaped = $escaped;
     $this->quote = isset($string[0]) ? $string[0] : '';
     $this->index = $index;
     $this->currentFileInfo = $currentFileInfo;
 }
Ejemplo n.º 5
0
 /**
  * Constructor
  *
  * @param string $value
  * @param UnitNode|string $unit
  */
 public function __construct($value, $unit = null)
 {
     parent::__construct(floatval($value));
     if (!$unit instanceof UnitNode) {
         $unit = $unit ? new UnitNode([$unit]) : new UnitNode();
     }
     $this->unit = $unit;
 }
Ejemplo n.º 6
0
 /**
  * Constructor
  *
  * @param string|ValueNode|null $value
  * @param integer $index
  * @param FileInfo $currentFileInfo
  * @param boolean $mapLines
  * @param boolean $rulesetLike
  * @param boolean $referenced
  */
 public function __construct($value, $index = 0, FileInfo $currentFileInfo = null, $mapLines = false, $rulesetLike = false, $referenced = false)
 {
     parent::__construct($value);
     $this->index = $index;
     $this->currentFileInfo = $currentFileInfo;
     $this->mapLines = $mapLines;
     $this->rulesetLike = (bool) $rulesetLike;
     $this->isReferenced = $referenced;
 }
Ejemplo n.º 7
0
 /**
  * Constructor
  *
  * @param string|array $rgb The rgb value
  * @param integer $alpha Alpha channel
  * @param string $originalForm Original form of the color
  * @throws InvalidArgumentException
  */
 public function __construct($rgb, $alpha = 1, $originalForm = null)
 {
     if (!$rgb instanceof Color) {
         $value = new Color($rgb, $alpha, $originalForm);
     } else {
         $value = $rgb;
     }
     /* @var $value \ILess\Color */
     parent::__construct($value);
 }
Ejemplo n.º 8
0
 /**
  * Constructor
  *
  * @param string $value The string
  */
 public function __construct($value = null)
 {
     if ($value === ' ') {
         $this->emptyOrWhitespace = true;
     } else {
         $value = trim($value);
         $this->emptyOrWhitespace = $value === '';
     }
     parent::__construct($value);
 }
Ejemplo n.º 9
0
 /**
  * Constructor.
  *
  * @param string|array $name The rule name
  * @param string|ValueNode $value The value
  * @param string $important Important keyword
  * @param string|null $merge Merge?
  * @param int $index Current index
  * @param FileInfo $currentFileInfo The current file info
  * @param bool $inline Inline flag
  * @param bool|null $variable
  */
 public function __construct($name, $value, $important = null, $merge = null, $index = 0, FileInfo $currentFileInfo = null, $inline = false, $variable = null)
 {
     parent::__construct($value instanceof Node ? $value : new ValueNode([$value]));
     $this->name = $name;
     $this->important = $important ? ' ' . trim($important) : '';
     $this->merge = $merge;
     $this->index = $index;
     $this->currentFileInfo = $currentFileInfo;
     $this->inline = (bool) $inline;
     $this->variable = null !== $variable ? $variable : is_string($name) && $name[0] === '@';
 }
Ejemplo n.º 10
0
 /**
  * Constructor
  *
  * @param CombinatorNode|string $combinator The combinator
  * @param string|Node $value The value
  * @param integer $index The current index
  * @param FileInfo $currentFileInfo Current file information
  */
 public function __construct($combinator, $value, $index = 0, FileInfo $currentFileInfo = null)
 {
     $this->combinator = $combinator instanceof CombinatorNode ? $combinator : new CombinatorNode($combinator);
     if (is_string($value)) {
         $value = trim($value);
     } elseif (!$value) {
         $value = '';
     }
     parent::__construct($value);
     $this->index = $index;
     $this->currentFileInfo = $currentFileInfo;
 }
Ejemplo n.º 11
0
 /**
  * Constructor.
  *
  * @param string|Node $key
  * @param string $operator
  * @param string|Node $value
  */
 public function __construct($key, $operator, $value)
 {
     $this->key = $key;
     $this->operator = $operator;
     parent::__construct($value);
 }
Ejemplo n.º 12
0
 /**
  * Constructor
  *
  * @param array $value
  * @throws Exception
  */
 public function __construct(array $value)
 {
     parent::__construct($value);
 }
Ejemplo n.º 13
0
 /**
  * Constructor.
  *
  * @param string $key
  * @param string|Node $value
  */
 public function __construct($key, $value)
 {
     parent::__construct($value);
     $this->key = $key;
 }