Passed
Push — master ( 4c697a...778310 )
by Kacper
02:53
created
Language/IniLanguage.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Highlighter
4
- *
5
- * Copyright (C) 2015, Some right reserved.
6
- *
7
- * @author Kacper "Kadet" Donat <[email protected]>
8
- *
9
- * Contact with author:
10
- * Xmpp: [email protected]
11
- * E-mail: [email protected]
12
- *
13
- * From Kadet with love.
14
- */
3
+     * Highlighter
4
+     *
5
+     * Copyright (C) 2015, Some right reserved.
6
+     *
7
+     * @author Kacper "Kadet" Donat <[email protected]>
8
+     *
9
+     * Contact with author:
10
+     * Xmpp: [email protected]
11
+     * E-mail: [email protected]
12
+     *
13
+     * From Kadet with love.
14
+     */
15 15
 
16 16
 namespace Kadet\Highlighter\Utils;
17 17
 
Please login to merge, or discard this patch.
Language/HtmlLanguage.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Highlighter
4
- *
5
- * Copyright (C) 2016, Some right reserved.
6
- *
7
- * @author Kacper "Kadet" Donat <[email protected]>
8
- *
9
- * Contact with author:
10
- * Xmpp: [email protected]
11
- * E-mail: [email protected]
12
- *
13
- * From Kadet with love.
14
- */
3
+     * Highlighter
4
+     *
5
+     * Copyright (C) 2016, Some right reserved.
6
+     *
7
+     * @author Kacper "Kadet" Donat <[email protected]>
8
+     *
9
+     * Contact with author:
10
+     * Xmpp: [email protected]
11
+     * E-mail: [email protected]
12
+     *
13
+     * From Kadet with love.
14
+     */
15 15
 
16 16
 namespace Kadet\Highlighter\Language;
17 17
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
         $js = new JavaScriptLanguage();
29 29
 
30 30
         return array_merge(parent::getRules(), [
31
-            'language.'.$js->getIdentifier() => [
31
+            'language.' . $js->getIdentifier() => [
32 32
                 new OpenRule(new RegexMatcher('/<script.*?>()/'), [
33 33
                     'factory'     => new TokenFactory('Kadet\\Highlighter\\Parser\\LanguageToken'),
34 34
                     'inject'      => $js,
Please login to merge, or discard this patch.
Parser/TokenIterator.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Highlighter
4
- *
5
- * Copyright (C) 2016, Some right reserved.
6
- *
7
- * @author Kacper "Kadet" Donat <[email protected]>
8
- *
9
- * Contact with author:
10
- * Xmpp: [email protected]
11
- * E-mail: [email protected]
12
- *
13
- * From Kadet with love.
14
- */
3
+     * Highlighter
4
+     *
5
+     * Copyright (C) 2016, Some right reserved.
6
+     *
7
+     * @author Kacper "Kadet" Donat <[email protected]>
8
+     *
9
+     * Contact with author:
10
+     * Xmpp: [email protected]
11
+     * E-mail: [email protected]
12
+     *
13
+     * From Kadet with love.
14
+     */
15 15
 
16 16
 namespace Kadet\Highlighter\Language;
17 17
 
Please login to merge, or discard this patch.
KeyLighter.php 1 patch
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public static function getLanguage($name) {
38 38
         $embedded = [];
39
-        if(($pos = strpos($name, '>')) !== false) {
39
+        if (($pos = strpos($name, '>')) !== false) {
40 40
             $embedded[] = self::getLanguage(trim(substr($name, $pos + 1)));
41 41
             $name       = trim(substr($name, 0, $pos));
42 42
         }
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     public static function highlight($source, $language, FormatterInterface $formatter = null) {
71 71
         $formatter = $formatter ?: self::getDefaultFormatter();
72 72
 
73
-        if(!$language instanceof Language) {
73
+        if (!$language instanceof Language) {
74 74
             $language = self::getLanguage($language);
75 75
         }
76 76
 
@@ -82,8 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
 KeyLighter::setDefaultFormatter(
84 84
     php_sapi_name() === 'cli' ?
85
-        new CliFormatter() :
86
-        new HtmlFormatter()
85
+        new CliFormatter() : new HtmlFormatter()
87 86
 );
88 87
 
89 88
 KeyLighter::registerLanguage('Kadet\\Highlighter\\Language\\PhpLanguage', ['php']);
Please login to merge, or discard this patch.
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.