/** * @param string|null $ruleString * @param StyleSheet|null $styleSheet */ public function __construct($ruleString = null, StyleSheet $styleSheet = null) { if ($styleSheet !== null) { $this->setStyleSheet($styleSheet); } if ($ruleString !== null) { $ruleString = Placeholder::replaceStringsAndComments($ruleString); $ruleString = Placeholder::removeCommentPlaceholders($ruleString, true); $this->parseRuleString($ruleString); } }
/** * Checks the selector value. * * @param $value * @return bool */ public function checkValue(&$value) { if (is_string($value)) { $value = Placeholder::replaceStringsAndComments($value); $value = Placeholder::removeCommentPlaceholders($value, true); $value = preg_replace('/[ ]+/', ' ', $value); $value = Placeholder::replaceStringPlaceholders($value, true); return true; } else { throw new \InvalidArgumentException("Invalid type '" . gettype($value) . "' for argument 'value' given."); } }
/** * Checks the declaration value. * * @param string $value * @return bool */ public function checkValue(&$value) { if (is_string($value)) { $value = Placeholder::replaceStringsAndComments($value); $value = Placeholder::removeCommentPlaceholders($value, true); $value = Placeholder::replaceStringPlaceholders($value, true); $value = trim($value); if ($value !== '') { return true; } else { $this->setIsValid(false); } } else { throw new \InvalidArgumentException("Invalid type '" . gettype($value) . "' for argument 'value' given."); } }