@@ -43,7 +43,7 @@ |
||
| 43 | 43 | $this->_end->_valid = false; |
| 44 | 44 | } |
| 45 | 45 | } else { |
| 46 | - if (!$this->rule->validator->validate($context, [$this->name => Validator::CONTEXT_IN ])) { |
|
| 46 | + if (!$this->rule->validator->validate($context, [$this->name => Validator::CONTEXT_IN])) { |
|
| 47 | 47 | $this->setValid(false); |
| 48 | 48 | } else { |
| 49 | 49 | $this->_valid = false; |
@@ -58,11 +58,11 @@ |
||
| 58 | 58 | |
| 59 | 59 | public function process(array &$context, Language $language, Result $result, TokenIterator $tokens) |
| 60 | 60 | { |
| 61 | - if(!$this->isValid($language, $context)) { |
|
| 61 | + if (!$this->isValid($language, $context)) { |
|
| 62 | 62 | return true; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - if($this->isStart()) { |
|
| 65 | + if ($this->isStart()) { |
|
| 66 | 66 | $result->merge($this->getInjected()->parse($tokens)); |
| 67 | 67 | } else { |
| 68 | 68 | $this->setStart($result[0]); |
@@ -197,18 +197,18 @@ discard block |
||
| 197 | 197 | * @return bool Continue? |
| 198 | 198 | */ |
| 199 | 199 | public function process(array &$context, Language $language, Result $result, TokenIterator $tokens) { |
| 200 | - if(!$this->isValid($language, $context)) { |
|
| 200 | + if (!$this->isValid($language, $context)) { |
|
| 201 | 201 | return true; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - if($this->isStart()) { |
|
| 204 | + if ($this->isStart()) { |
|
| 205 | 205 | $result->append($this); |
| 206 | 206 | $context[$tokens->key()] = $this->name; |
| 207 | 207 | } else { |
| 208 | - if($this->_start) { |
|
| 208 | + if ($this->_start) { |
|
| 209 | 209 | unset($context[spl_object_hash($this->_start)]); |
| 210 | 210 | } else { |
| 211 | - $start = ArrayHelper::find(array_reverse($context), function ($k, $v) { |
|
| 211 | + $start = ArrayHelper::find(array_reverse($context), function($k, $v) { |
|
| 212 | 212 | return $v === $this->closedBy; |
| 213 | 213 | }); |
| 214 | 214 | |
@@ -240,11 +240,11 @@ discard block |
||
| 240 | 240 | return $multiplier; |
| 241 | 241 | } |
| 242 | 242 | } elseif (($rule = Helper::cmp($b->rule->priority, $a->rule->priority)) !== 0) { |
| 243 | - return $multiplier*$rule; |
|
| 243 | + return $multiplier * $rule; |
|
| 244 | 244 | } elseif (($rule = Helper::cmp($b->index, $a->index)) !== 0) { |
| 245 | - return $multiplier*$rule; |
|
| 245 | + return $multiplier * $rule; |
|
| 246 | 246 | } else { |
| 247 | - return $multiplier*($a->id < $b->id ? -1 : 1); |
|
| 247 | + return $multiplier * ($a->id < $b->id ? -1 : 1); |
|
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | ]); |
| 100 | 100 | |
| 101 | 101 | for ($tokens->next(); $tokens->valid(); $tokens->next()) { |
| 102 | - if(!$tokens->current()->process($context, $this, $result, $tokens)) { |
|
| 102 | + if (!$tokens->current()->process($context, $this, $result, $tokens)) { |
|
| 103 | 103 | break; |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | private function _rules($embedded = false) |
| 150 | 150 | { |
| 151 | 151 | $rules = clone $this->rules; |
| 152 | - if(is_bool($embedded)) { |
|
| 153 | - $rules->addMany(['language.'.$this->getIdentifier() => $this->getEnds($embedded)]); |
|
| 152 | + if (is_bool($embedded)) { |
|
| 153 | + $rules->addMany(['language.' . $this->getIdentifier() => $this->getEnds($embedded)]); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | foreach ($rules->all() as $rule) { |