Test Setup Failed
Push — master ( ac261d...91041f )
by Kacper
02:33
created
Language/TokenDump.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/Language.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) 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.
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()->getLanguage() === $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->getLanguage() === false) {
168
+                if ($rule->getLanguage() === false) {
169 169
                     $rule->setLanguage($this);
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/Token.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) 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.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,13 +91,13 @@
 block discarded – undo
91 91
             $multiplier = $a->isEnd() ? -1 : 1;
92 92
 
93 93
             if (($rule = Helper::cmp($b->_rule->getPriority(), $a->_rule->getPriority())) !== 0) {
94
-                return $multiplier*$rule;
94
+                return $multiplier * $rule;
95 95
             } elseif (($a->isStart() && !$b->isStart()) || ($a->isEnd() && !$b->isEnd())) {
96 96
                 return $multiplier;
97 97
             } elseif (($rule = Helper::cmp($b->index, $a->index)) !== 0) {
98
-                return $multiplier*$rule;
98
+                return $multiplier * $rule;
99 99
             } else {
100
-                return $multiplier*($a->id < $b->id ? -1 : 1);
100
+                return $multiplier * ($a->id < $b->id ? -1 : 1);
101 101
             }
102 102
         }
103 103
 
Please login to merge, or discard this patch.
Parser/OpenRule.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
- *1
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
+     *1
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.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 {
21 21
     public function match($source)
22 22
     {
23
-        return array_filter(parent::match($source), function (Token $token) {
23
+        return array_filter(parent::match($source), function(Token $token) {
24 24
             if ($token->isEnd()) {
25 25
                 $token->setStart(null);
26 26
 
Please login to merge, or discard this patch.
Parser/TokenFactoryInterface.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/LatexLanguage.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.
Matcher/SubStringMatcher.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
- *1
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
+     *1
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.
bin/keylighter.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@
 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
- *
15
- * Just Simple CLI App implementation, subject to change.
16
- */
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
+     * Just Simple CLI App implementation, subject to change.
16
+     */
17 17
 
18 18
 use Kadet\Highlighter\Utils\Console;
19 19
 
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 
18 18
 use Kadet\Highlighter\Utils\Console;
19 19
 
20
-require __DIR__.'/../vendor/autoload.php';
20
+require __DIR__ . '/../vendor/autoload.php';
21 21
 
22
-$title = Console::styled(['color' => 'yellow'], 'KeyLighter ').'v'.\Kadet\Highlighter\KeyLighter::VERSION.' by Kadet';
22
+$title = Console::styled(['color' => 'yellow'], 'KeyLighter ') . 'v' . \Kadet\Highlighter\KeyLighter::VERSION . ' by Kadet';
23 23
 $formatters = [
24 24
     'html' => new \Kadet\Highlighter\Formatter\HtmlFormatter(),
25 25
     'cli'  => new \Kadet\Highlighter\Formatter\CliFormatter(),
@@ -27,17 +27,17 @@  discard block
 block discarded – undo
27 27
 
28 28
 function printTable($table, $spacing = 4) {
29 29
     $max = [];
30
-    foreach(array_keys(reset($table)) as $key) {
30
+    foreach (array_keys(reset($table)) as $key) {
31 31
         $max[$key] = max(array_map(function($option) use ($key) { return strlen($option[$key]); }, $table)) + $spacing;
32 32
     }
33 33
 
34
-    if(isset($key)) {
34
+    if (isset($key)) {
35 35
         $max[$key] = 0; // Reset last
36 36
     }
37 37
 
38 38
     foreach ($table as $option) {
39 39
         echo "\t";
40
-        foreach($option as $key => $cell) {
40
+        foreach ($option as $key => $cell) {
41 41
             echo str_pad($cell, $max[$key], ' ', STR_PAD_RIGHT);
42 42
         }
43 43
         echo PHP_EOL;
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 function getOption($options, $value = true, $default = null) {
54 54
     global $argv;
55 55
 
56
-    foreach($options as $option) {
57
-        if($pos = array_search($option, $argv)) {
56
+    foreach ($options as $option) {
57
+        if ($pos = array_search($option, $argv)) {
58 58
             $return = !$value || !isset($argv[$pos + 1]) ? $default : $argv[$pos + 1];
59 59
 
60
-            if($value && isset($argv[$pos + 1])) {
61
-                unset($argv[$pos+1]);
60
+            if ($value && isset($argv[$pos + 1])) {
61
+                unset($argv[$pos + 1]);
62 62
             }
63 63
             unset($argv[$pos]);
64 64
 
@@ -70,29 +70,29 @@  discard block
 block discarded – undo
70 70
 }
71 71
 
72 72
 function benchmark($description, callable $callable) {
73
-    echo Console::styled(['color' => 'yellow'], $description.'... ');
73
+    echo Console::styled(['color' => 'yellow'], $description . '... ');
74 74
     $start = microtime(true);
75 75
         $return = $callable();
76 76
     $done = microtime(true) - $start;
77
-    echo Console::styled(['color' => 'green'], 'Done! ').number_format($done, 3).'s'.PHP_EOL;
77
+    echo Console::styled(['color' => 'green'], 'Done! ') . number_format($done, 3) . 's' . PHP_EOL;
78 78
 
79 79
     return $return;
80 80
 }
81 81
 
82
-if($argc == 1) {
82
+if ($argc == 1) {
83 83
     echo $title, PHP_EOL, PHP_EOL;
84 84
 
85
-    echo Console::styled(['color' => 'green'], 'Usage: '), 'php '.$argv[0].' [options] file', PHP_EOL;
85
+    echo Console::styled(['color' => 'green'], 'Usage: '), 'php ' . $argv[0] . ' [options] file', PHP_EOL;
86 86
 
87 87
     echo Console::styled(['color' => 'green'], 'Options: '), PHP_EOL;
88 88
     printTable([
89
-        ['-l, --language',    'language', 'Source Language to highlight, default: html > php'],
90
-        ['-f, --format',      'format',   'Formatter used to highlight source, for example: html, default: cli'],
91
-        ['-h, --help',         null,      'This screen'],
92
-        ['-v, --verbose',     'level',    'Verbose mode'],
93
-        ['-lf, --formatters',  null,      'List available formatters'],
94
-        ['-ll, --languages',   null,      'List available languages'],
95
-        ['-s, --silent',       null,      'No output, '],
89
+        ['-l, --language', 'language', 'Source Language to highlight, default: html > php'],
90
+        ['-f, --format', 'format', 'Formatter used to highlight source, for example: html, default: cli'],
91
+        ['-h, --help', null, 'This screen'],
92
+        ['-v, --verbose', 'level', 'Verbose mode'],
93
+        ['-lf, --formatters', null, 'List available formatters'],
94
+        ['-ll, --languages', null, 'List available languages'],
95
+        ['-s, --silent', null, 'No output, '],
96 96
 
97 97
     ]);
98 98
     exit(0);
@@ -100,19 +100,19 @@  discard block
 block discarded – undo
100 100
 
101 101
 unset($argv[0]);
102 102
 
103
-if(getOption(['-ll', '--languages'], false, true)) {
103
+if (getOption(['-ll', '--languages'], false, true)) {
104 104
     $languages = \Kadet\Highlighter\KeyLighter::registeredLanguages();
105 105
 
106 106
     $result = [];
107
-    foreach($languages as $alias => $class) {
108
-        if(!isset($result[$class])) {
107
+    foreach ($languages as $alias => $class) {
108
+        if (!isset($result[$class])) {
109 109
             $result[$class] = ['aliases' => [], 'class' => $class];
110 110
         }
111 111
 
112 112
         $result[$class]['aliases'][] = $alias;
113 113
     }
114 114
 
115
-    echo Console::styled(['color' => 'green'], 'Available languages: ').PHP_EOL;
115
+    echo Console::styled(['color' => 'green'], 'Available languages: ') . PHP_EOL;
116 116
 
117 117
     printTable(array_map(function($language) {
118 118
         return [
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
     exit(0);
126 126
 }
127 127
 
128
-if(getOption(['-lf', '--formatters'], false, true)) {
129
-    echo Console::styled(['color' => 'green'], 'Available formatters: ').PHP_EOL;
128
+if (getOption(['-lf', '--formatters'], false, true)) {
129
+    echo Console::styled(['color' => 'green'], 'Available formatters: ') . PHP_EOL;
130 130
     printTable(array_map(function($name, $formatter) {
131 131
         return [
132 132
             Console::styled(['color' => 'yellow'], $name),
@@ -138,43 +138,43 @@  discard block
 block discarded – undo
138 138
 }
139 139
 
140 140
 $language  = \Kadet\Highlighter\KeyLighter::getLanguage(getOption(['-l', '--language']) ?: 'html > php');
141
-$verbose   = getOption(['-v', '--verbose'], true, 1)  ?: 0;
141
+$verbose   = getOption(['-v', '--verbose'], true, 1) ?: 0;
142 142
 $formatter = getFormatter(getOption(['-f', '--format'])) ?: \Kadet\Highlighter\KeyLighter::getDefaultFormatter();
143 143
 $silent    = getOption(['-s', '--silent'], false, true);
144 144
 
145 145
 $file = reset($argv);
146 146
 
147
-if($verbose > 0) {
148
-    echo $title.PHP_EOL;
147
+if ($verbose > 0) {
148
+    echo $title . PHP_EOL;
149 149
     echo PHP_EOL;
150
-    echo Console::styled(['color' => 'green'], 'Language:  ').get_class($language).PHP_EOL;
150
+    echo Console::styled(['color' => 'green'], 'Language:  ') . get_class($language) . PHP_EOL;
151 151
 
152 152
     $embedded = $language->getEmbedded();
153
-    if(!empty($embedded)) {
154
-        echo Console::styled(['color' => 'green'], '    With:  ').implode(', ', array_map('get_class', $embedded)).PHP_EOL;
153
+    if (!empty($embedded)) {
154
+        echo Console::styled(['color' => 'green'], '    With:  ') . implode(', ', array_map('get_class', $embedded)) . PHP_EOL;
155 155
 
156 156
     }
157 157
 
158
-    echo Console::styled(['color' => 'green'], 'Formatter: ').get_class($formatter).PHP_EOL;
159
-    echo Console::styled(['color' => 'green'], 'File:      ').$file.PHP_EOL;
158
+    echo Console::styled(['color' => 'green'], 'Formatter: ') . get_class($formatter) . PHP_EOL;
159
+    echo Console::styled(['color' => 'green'], 'File:      ') . $file . PHP_EOL;
160 160
     echo PHP_EOL;
161 161
 }
162 162
 
163
-if(!file_exists($file)) {
164
-    echo Console::styled(['color' => 'red'], 'File not exists.').PHP_EOL;
163
+if (!file_exists($file)) {
164
+    echo Console::styled(['color' => 'red'], 'File not exists.') . PHP_EOL;
165 165
     die(1);
166 166
 }
167 167
 
168 168
 $source = file_get_contents($file);
169
-if($verbose > 1) {
169
+if ($verbose > 1) {
170 170
     $tokens    = benchmark('Tokenization', function() use($language, $source) { return $language->tokenize($source); });
171 171
     $tokens    = benchmark('Parsing', function() use($language, $tokens) { return $language->parse($tokens); });
172 172
     $formatted = benchmark('Formatting', function() use($formatter, $tokens, $source) {
173 173
         return $formatter->format($tokens);
174 174
     });
175 175
 
176
-    if(function_exists('xdebug_peak_memory_usage')) {
177
-        echo Console::styled(['color' => 'green'], 'Max memory usage: ').number_format(xdebug_peak_memory_usage()/1024/1024, 4).'MBytes'.PHP_EOL;
176
+    if (function_exists('xdebug_peak_memory_usage')) {
177
+        echo Console::styled(['color' => 'green'], 'Max memory usage: ') . number_format(xdebug_peak_memory_usage() / 1024 / 1024, 4) . 'MBytes' . PHP_EOL;
178 178
     }
179 179
 
180 180
     echo PHP_EOL;
@@ -182,6 +182,6 @@  discard block
 block discarded – undo
182 182
     $formatted = \Kadet\Highlighter\KeyLighter::highlight($source, $language, $formatter);
183 183
 }
184 184
 
185
-if(!$silent) {
186
-    echo $formatted.PHP_EOL;
185
+if (!$silent) {
186
+    echo $formatted . PHP_EOL;
187 187
 }
188 188
\ No newline at end of file
Please login to merge, or discard this patch.
KeyLighter.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) 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.
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.