Completed
Push — master ( 562cfa...f8b2ff )
by Kacper
02:42 queued 25s
created
Matcher/WordMatcher.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
         ], $options);
35 35
 
36 36
         if ($options['escape']) {
37
-            $words = array_map(function ($word) {
37
+            $words = array_map(function($word) {
38 38
                 return preg_quote($word, '/');
39 39
             }, $words);
40 40
         }
Please login to merge, or discard this 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.
Matcher/CommentMatcher.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
         $all = [];
53 53
 
54 54
         foreach ($this->multiLine as $name => $comment) {
55
-            $comment = array_map(function ($e) { return preg_quote($e, '/'); }, $comment);
55
+            $comment = array_map(function($e) { return preg_quote($e, '/'); }, $comment);
56 56
 
57 57
             $all[] = [$name, "/{$comment[0]}(.*?){$comment[1]}/ms"];
58 58
         }
Please login to merge, or discard this 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.
highlight.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   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 require 'vendor/autoload.php';
21 21
 
22
-$title = Console::open(['color' => 'yellow']).'KeyLighter '.Console::close().'v'.\Kadet\Highlighter\Highlighter::VERSION.' by Kadet';
22
+$title = Console::open(['color' => 'yellow']) . 'KeyLighter ' . Console::close() . 'v' . \Kadet\Highlighter\Highlighter::VERSION . ' by Kadet';
23 23
 
24 24
 function printOptions($options) {
25 25
     $maxOption = max(array_map(function($option) { return strlen($option[0]); }, $options)) + 4;
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         echo "\t";
32 32
         echo str_pad($option, $maxOption, ' ', STR_PAD_RIGHT);
33 33
         echo str_pad($argument, $maxArg, ' ', STR_PAD_RIGHT);
34
-        echo $description.PHP_EOL;
34
+        echo $description . PHP_EOL;
35 35
     }
36 36
 }
37 37
 
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 function getOption($options, $value = true, $default = null) {
48 48
     global $argv;
49 49
 
50
-    foreach($options as $option) {
51
-        if($pos = array_search($option, $argv)) {
50
+    foreach ($options as $option) {
51
+        if ($pos = array_search($option, $argv)) {
52 52
             $return = !$value || !isset($argv[$pos + 1]) ? $default : $argv[$pos + 1];
53 53
 
54
-            if($value && isset($argv[$pos + 1])) {
55
-                unset($argv[$pos+1]);
54
+            if ($value && isset($argv[$pos + 1])) {
55
+                unset($argv[$pos + 1]);
56 56
             }
57 57
             unset($argv[$pos]);
58 58
 
@@ -64,26 +64,26 @@  discard block
 block discarded – undo
64 64
 }
65 65
 
66 66
 function benchmark($description, callable $callable) {
67
-    echo Console::open(['color' => 'yellow']).$description.'... '.Console::close();
67
+    echo Console::open(['color' => 'yellow']) . $description . '... ' . Console::close();
68 68
     $start = microtime(true);
69 69
         $return = $callable();
70 70
     $done = microtime(true) - $start;
71
-    echo Console::open(['color' => 'green']).'Done! '.Console::close().number_format($done, 3).'s'.PHP_EOL;
71
+    echo Console::open(['color' => 'green']) . 'Done! ' . Console::close() . number_format($done, 3) . 's' . PHP_EOL;
72 72
 
73 73
     return $return;
74 74
 }
75 75
 
76
-if($argc == 1) {
76
+if ($argc == 1) {
77 77
     echo $title, PHP_EOL, PHP_EOL;
78 78
 
79
-    echo Console::open(['color' => 'green']).'Usage: '.Console::close(), 'php '.$argv[0].' [options] file', PHP_EOL;
79
+    echo Console::open(['color' => 'green']) . 'Usage: ' . Console::close(), 'php ' . $argv[0] . ' [options] file', PHP_EOL;
80 80
 
81
-    echo Console::open(['color' => 'green']).'Options: '.Console::close(), PHP_EOL;
81
+    echo Console::open(['color' => 'green']) . 'Options: ' . Console::close(), PHP_EOL;
82 82
     printOptions([
83 83
         ['-l, --language', 'language', 'Source Language to highlight, default: xml > php'],
84
-        ['-f, --format',   'format',   'Formatter used to highlight source, for example: html, default: cli'],
85
-        ['-h, --help',      null,      'This screen'],
86
-        ['-v, --verbose',  'level',    'Verbose mode']
84
+        ['-f, --format', 'format', 'Formatter used to highlight source, for example: html, default: cli'],
85
+        ['-h, --help', null, 'This screen'],
86
+        ['-v, --verbose', 'level', 'Verbose mode']
87 87
     ]);
88 88
     exit(0);
89 89
 }
@@ -91,33 +91,33 @@  discard block
 block discarded – undo
91 91
 unset($argv[0]);
92 92
 
93 93
 $language = \Kadet\Highlighter\Highlighter::getLanguage(getOption(['-l', '--language']) ?: 'php');
94
-$verbose  = getOption(['-v', '--verbose'], true, 1)  ?: 0;
94
+$verbose  = getOption(['-v', '--verbose'], true, 1) ?: 0;
95 95
 $formatter = getFormatter(getOption(['-f', '--format'])) ?: \Kadet\Highlighter\Highlighter::getDefaultFormatter();
96 96
 $file = reset($argv);
97 97
 
98
-if($verbose > 0) {
99
-    echo $title.PHP_EOL;
98
+if ($verbose > 0) {
99
+    echo $title . PHP_EOL;
100 100
     echo PHP_EOL;
101
-    echo Console::open(['color' => 'green']).'Language:  '.Console::close().get_class($language).PHP_EOL;
101
+    echo Console::open(['color' => 'green']) . 'Language:  ' . Console::close() . get_class($language) . PHP_EOL;
102 102
 
103 103
     $embedded = $language->getEmbedded();
104
-    if(!empty($embedded)) {
105
-        echo Console::open(['color' => 'green']).'    With:  '.Console::close().implode(', ', array_map('get_class', $embedded)).PHP_EOL;
104
+    if (!empty($embedded)) {
105
+        echo Console::open(['color' => 'green']) . '    With:  ' . Console::close() . implode(', ', array_map('get_class', $embedded)) . PHP_EOL;
106 106
 
107 107
     }
108 108
 
109
-    echo Console::open(['color' => 'green']).'Formatter: '.Console::close().get_class($formatter).PHP_EOL;
110
-    echo Console::open(['color' => 'green']).'File:      '.Console::close().$file.PHP_EOL;
109
+    echo Console::open(['color' => 'green']) . 'Formatter: ' . Console::close() . get_class($formatter) . PHP_EOL;
110
+    echo Console::open(['color' => 'green']) . 'File:      ' . Console::close() . $file . PHP_EOL;
111 111
     echo PHP_EOL;
112 112
 }
113 113
 
114
-if(!file_exists($file)) {
115
-    echo Console::open(['color' => 'red']).'File not exists.'.Console::close().PHP_EOL;
114
+if (!file_exists($file)) {
115
+    echo Console::open(['color' => 'red']) . 'File not exists.' . Console::close() . PHP_EOL;
116 116
     die(1);
117 117
 }
118 118
 
119 119
 $source = file_get_contents($file);
120
-if($verbose > 1) {
120
+if ($verbose > 1) {
121 121
     $tokens    = benchmark('Tokenization', function() use($language, $source) { return $language->tokenize($source); });
122 122
     $tokens    = benchmark('Parsing', function() use($language, $tokens) { return $language->parse($tokens); });
123 123
     $formatted = benchmark('Formatting', function() use($formatter, $tokens, $source) {
Please login to merge, or discard this patch.
Utils/StringHelper.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             $needle = [$needle];
51 51
         }
52 52
 
53
-        $results = array_map(function ($str) use ($haystack, $offset) {
53
+        $results = array_map(function($str) use ($haystack, $offset) {
54 54
             return [$str, strpos($haystack, $str, $offset)];
55 55
         }, $needle);
56 56
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
         $results = array_filter(
62 62
             array_combine(ArrayHelper::column($results, 0), ArrayHelper::column($results, 1)),
63
-            function ($a) {
63
+            function($a) {
64 64
                 return $a !== false;
65 65
             }
66 66
         );
Please login to merge, or discard this 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.
Utils/Console.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     public static function close()
45 45
     {
46 46
         self::$_current = empty(self::$_stack) ? self::$_default : array_pop(self::$_stack);
47
-        return "\033[0m".self::_set(array_diff(self::$_current, self::$_default));
47
+        return "\033[0m" . self::_set(array_diff(self::$_current, self::$_default));
48 48
     }
49 49
 
50 50
     private static function _color($name, $bg = false)
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     }
74 74
 
75 75
     private static function _style($name, $value) {
76
-        switch($name) {
76
+        switch ($name) {
77 77
             case 'color':
78 78
                 return self::_color($value);
79 79
             case 'background':
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
     }
95 95
 
96 96
     private static function _set($style) {
97
-        $escape = "\033[".implode(';', array_map(function($style, $name) {
97
+        $escape = "\033[" . implode(';', array_map(function($style, $name) {
98 98
                 return self::_style($style, $name);
99
-            }, array_keys($style), $style)).'m';
99
+            }, array_keys($style), $style)) . 'm';
100 100
 
101 101
         return $escape;
102 102
     }
Please login to merge, or discard this patch.
Utils/ArrayHelper.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   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,14 +45,14 @@
 block discarded – undo
45 45
 
46 46
     public static function rearrange(array $array, array $keys)
47 47
     {
48
-        return array_combine($keys, array_map(function ($key) use ($array) {
48
+        return array_combine($keys, array_map(function($key) use ($array) {
49 49
             return $array[$key];
50 50
         }, $keys));
51 51
     }
52 52
 
53 53
     public static function column(array $array, $index)
54 54
     {
55
-        return array_map(function ($e) use ($index) { return $e[$index]; }, $array);
55
+        return array_map(function($e) use ($index) { return $e[$index]; }, $array);
56 56
     }
57 57
 
58 58
     public static function find(array $array, callable $tester)
Please login to merge, or discard this patch.
Utils/Helper.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.
Matcher/WholeMatcher.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.
Matcher/RegexMatcher.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.