예제 #1
0
 /**
  * @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);
     }
 }
예제 #2
0
 /**
  * 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.");
     }
 }
예제 #3
0
 /**
  * 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.");
     }
 }