Passed
Push — master ( 4c697a...778310 )
by Kacper
02:53
created
Language/Language.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     {
73 73
         if (is_string($tokens)) {
74 74
             $tokens = $this->tokenize($tokens, $additional);
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
 block discarded – undo
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
 block discarded – undo
109 109
                 if ($token instanceof LanguageToken && $token->getRule()->language === $this) {
110 110
                     $result[0]->setEnd($token);
111 111
 
112
-                    if($result[0]->getRule()->postProcess) {
112
+                    if ($result[0]->getRule()->postProcess) {
113 113
                         $source = substr($tokens->getSource(), $result[0]->pos, $result[0]->getLength());
114 114
 
115 115
                         $tokens = $this->tokenize($source, $result, $result[0]->pos);
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                     }
118 118
 
119 119
                     # closing unclosed tokens
120
-                    foreach(array_reverse($context) as $hash => $name) {
120
+                    foreach (array_reverse($context) as $hash => $name) {
121 121
                         $result[$hash]->setEnd(new Token([$name, 'pos' => $token->pos]));
122 122
                     }
123 123
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                         unset($context[spl_object_hash($start)]);
129 129
                     } else {
130 130
                         /** @noinspection PhpUnusedParameterInspection */
131
-                        $start = ArrayHelper::find(array_reverse($context), function ($k, $v) use ($token) {
131
+                        $start = ArrayHelper::find(array_reverse($context), function($k, $v) use ($token) {
132 132
                             return $v === $token->name;
133 133
                         });
134 134
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 
166 166
             /** @var Rule $rule */
167 167
             foreach ($rules as $rule) {
168
-                if($rule->language === false) {
168
+                if ($rule->language === false) {
169 169
                     $rule->language;
170 170
                 }
171 171
 
@@ -174,12 +174,12 @@  discard block
 block discarded – undo
174 174
             }
175 175
         }
176 176
 
177
-        foreach($this->getEmbedded() as $language) {
177
+        foreach ($this->getEmbedded() as $language) {
178 178
             $result = array_merge($result, $language->_tokens($source));
179 179
         }
180 180
 
181 181
         // Array map would be cool, but is a lot slower
182
-        if($offset) {
182
+        if ($offset) {
183 183
             foreach ($result as $item) {
184 184
                 $item->pos += $offset;
185 185
             }
Please login to merge, or discard this patch.
Parser/MarkerToken.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 
42 42
     protected function validate(Language $language, $context)
43 43
     {
44
-        if($language !== $this->getRule()->language) {
44
+        if ($language !== $this->getRule()->language) {
45 45
             return false;
46 46
         }
47 47
 
Please login to merge, or discard this patch.
Parser/TokenFactory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
     public function create($params) {
40 40
         $params[0] = !empty($params[0]) ? $this->getName($params[0]) : $this->_base;
41
-        if(empty($params['rule'])) {
41
+        if (empty($params['rule'])) {
42 42
             $params['rule'] = $this->_rule;
43 43
         }
44 44
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      */
102 102
     public function setClass($class)
103 103
     {
104
-        if(!is_a($class, 'Kadet\Highlighter\Parser\Token', true)) {
104
+        if (!is_a($class, 'Kadet\Highlighter\Parser\Token', true)) {
105 105
             throw new \InvalidArgumentException('$class must extend Kadet\Highlighter\Parser\Token');
106 106
         }
107 107
 
Please login to merge, or discard this patch.