@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | if (is_string($tokens)) { |
| 74 | 74 | $tokens = $this->tokenize($tokens); |
| 75 | - } elseif(!$tokens instanceof TokenIterator) { |
|
| 75 | + } elseif (!$tokens instanceof TokenIterator) { |
|
| 76 | 76 | throw new \InvalidArgumentException('$tokens must be string or TokenIterator'); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $all = []; |
| 86 | 86 | |
| 87 | 87 | /** @var Token $token */ |
| 88 | - for($tokens->next(); $tokens->valid(); $tokens->next()) { |
|
| 88 | + for ($tokens->next(); $tokens->valid(); $tokens->next()) { |
|
| 89 | 89 | $token = $tokens->current(); |
| 90 | 90 | |
| 91 | 91 | if (!$token->isValid($this, $context)) { |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | if ($token instanceof LanguageToken && $token->getRule()->getLanguage() === $this) { |
| 110 | 110 | $result[0]->setEnd($token); |
| 111 | 111 | |
| 112 | - if($result[0]->getRule()->postProcess) { |
|
| 112 | + if ($result[0]->getRule()->postProcess) { |
|
| 113 | 113 | $embed = $this |
| 114 | 114 | ->parse(substr($tokens->getSource(), $result[0]->pos, $result[0]->getLength())) |
| 115 | 115 | ->getTokens($result[0]->pos); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | # closing unclosed tokens |
| 121 | - foreach(array_reverse($context) as $hash => $name) { |
|
| 121 | + foreach (array_reverse($context) as $hash => $name) { |
|
| 122 | 122 | $result[$hash]->setEnd(new Token([$name, 'pos' => $token->pos])); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | unset($context[spl_object_hash($start)]); |
| 130 | 130 | } else { |
| 131 | 131 | /** @noinspection PhpUnusedParameterInspection */ |
| 132 | - $start = ArrayHelper::find(array_reverse($context), function ($k, $v) use ($token) { |
|
| 132 | + $start = ArrayHelper::find(array_reverse($context), function($k, $v) use ($token) { |
|
| 133 | 133 | return $v === $token->name; |
| 134 | 134 | }); |
| 135 | 135 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | /** @var Rule $rule */ |
| 168 | 168 | foreach ($rules as $rule) { |
| 169 | - if(strpos($name, 'language.') === false) { |
|
| 169 | + if (strpos($name, 'language.') === false) { |
|
| 170 | 170 | $rule->setLanguage($this); |
| 171 | 171 | } |
| 172 | 172 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - foreach($this->getEmbedded() as $language) { |
|
| 179 | + foreach ($this->getEmbedded() as $language) { |
|
| 180 | 180 | $result = array_merge($result, $language->_tokens($source)); |
| 181 | 181 | } |
| 182 | 182 | |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | $result = $this->getArrayCopy(); |
| 45 | 45 | |
| 46 | 46 | // Array map would be cool, but is a lot slower |
| 47 | - if($offset) { |
|
| 47 | + if ($offset) { |
|
| 48 | 48 | foreach ($result as $item) { |
| 49 | 49 | $item->pos += $offset; |
| 50 | 50 | } |