public function __construct($declarations_string, Rule $rule) { parent::__construct(); $pairs = DeclarationList::parse($declarations_string); foreach ($pairs as $index => $pair) { list($prop, $value) = $pair; // Directives. if ($prop === 'extends') { $rule->setExtendSelectors($value); unset($pairs[$index]); } elseif ($prop === 'name') { if (!$rule->name) { $rule->name = $value; } unset($pairs[$index]); } } // Build declaration list. foreach ($pairs as $index => &$pair) { list($prop, $value) = $pair; if (trim($value) !== '') { if ($prop === 'mixin') { $this->flattened = false; $this->store[] = $pair; } else { // Only store to $this->data if the value does not itself make a // this() call to avoid circular references. if (!preg_match(Regex::$patt->thisFunction, $value)) { $this->data[strtolower($prop)] = $value; } $this->add($prop, $value, $index); } } } }
public function __construct($selectorString, Rule $rule) { parent::__construct(); $selectorString = trim(Util::stripCommentTokens($selectorString)); foreach (Util::splitDelimList($selectorString) as $selector) { if (preg_match(Regex::$patt->abstract, $selector, $m)) { $rule->name = strtolower($m['name']); $rule->isAbstract = true; } else { $this->add(new Selector($selector)); } } }
/** * @param string $chunk * @param int $stackSize */ public function __construct($chunk, $stackSize = 8) { parent::__construct(new \ArrayIterator(StringUtils::toArray($chunk)), $stackSize); }
public function __construct(IIterator $iterator) { parent::__construct(); $this->outerIterator = $iterator; }