Exemple #1
0
 /**
  * @param \Customize\Model\Rule\Structure $rule
  * @param string|null $key
  * @return \Paragraph\Model\Dashboard\Structure
  */
 public function setRule(Rule\Structure $rule, $key = null)
 {
     if ($this->paragraph && ($rootId = $this->paragraph->getRootId())) {
         $rule->setRootParagraphId($rootId);
     }
     if (empty($key)) {
         $this->rules[] = $rule;
     } else {
         $this->rules[$key] = $rule;
     }
     return $this;
 }
Exemple #2
0
 /**
  * Accept property
  *
  * @param   RuleStructure $rule
  * @return  void
  */
 protected function acceptProperty(RuleStructure &$rule)
 {
     @(list($name, $this->buffer) = explode(':', $this->buffer, 2));
     $this->acceptWhiteSpace();
     $name = rtrim($name, self::WHITE_SPACE);
     $value = $this->acceptSafeValue();
     $matches = array();
     if (preg_match('/!([a-z]+)$/', $value, $matches)) {
         $priority = $matches[1];
         $value = rtrim(substr($value, 0, -strlen($matches[0])), self::WHITE_SPACE);
     } else {
         $priority = null;
     }
     $rule->setRawProperty($name, $value, $priority);
 }