public function addRule(Rule $oRule) { $sRule = $oRule->getRule(); if (!isset($this->aRules[$sRule])) { $this->aRules[$sRule] = array(); } $this->aRules[$sRule][] = $oRule; }
public function addRule(Rule $oRule, Rule $oSibling = null) { $sRule = $oRule->getRule(); if (!isset($this->aRules[$sRule])) { $this->aRules[$sRule] = array(); } $iPosition = count($this->aRules[$sRule]); if ($oSibling !== null) { $iSiblingPos = array_search($oSibling, $this->aRules[$sRule], true); if ($iSiblingPos !== false) { $iPosition = $iSiblingPos; } } array_splice($this->aRules[$sRule], $iPosition, 0, array($oRule)); }
private function parseRule() { $oRule = new Rule($this->parseIdentifier()); $this->consumeWhiteSpace(); $this->consume(':'); $oValue = $this->parseValue(self::listDelimiterForRule($oRule->getRule())); $oRule->setValue($oValue); if ($this->comes('!')) { $this->consume('!'); $this->consumeWhiteSpace(); $this->consume('important'); $oRule->setIsImportant(true); } while ($this->comes(';')) { $this->consume(';'); $this->consumeWhiteSpace(); } return $oRule; }
private function parseRule() { $aComments = $this->consumeWhiteSpace(); $oRule = new Rule($this->parseIdentifier(), $this->iLineNo); $oRule->setComments($aComments); $oRule->addComments($this->consumeWhiteSpace()); $this->consume(':'); $oValue = $this->parseValue(self::listDelimiterForRule($oRule->getRule())); $oRule->setValue($oValue); if ($this->oParserSettings->bLenientParsing) { while ($this->comes('\\')) { $this->consume('\\'); $oRule->addIeHack($this->consume()); $this->consumeWhiteSpace(); } } if ($this->comes('!')) { $this->consume('!'); $this->consumeWhiteSpace(); $this->consume('important'); $oRule->setIsImportant(true); } while ($this->comes(';')) { $this->consume(';'); } return $oRule; }