Completed
Push — master ( b2c699...f42af0 )
by Kacper
02:37
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   +7 added lines, -7 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);
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
                         $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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
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.
Formatter/FormatterInterface.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.
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   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public static function getLanguage($name) {
39 39
         $embedded = [];
40
-        if(($pos = strpos($name, '>')) !== false) {
40
+        if (($pos = strpos($name, '>')) !== false) {
41 41
             $embedded[] = self::getLanguage(trim(substr($name, $pos + 1)));
42 42
             $name       = trim(substr($name, 0, $pos));
43 43
         }
44 44
 
45
-        if(!isset(self::$_languages[$name])) {
45
+        if (!isset(self::$_languages[$name])) {
46 46
             throw new \InvalidArgumentException("Language $name is not defined.");
47 47
         }
48 48
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     public static function highlight($source, $language, FormatterInterface $formatter = null) {
69 69
         $formatter = $formatter ?: self::getDefaultFormatter();
70 70
 
71
-        if(!$language instanceof Language) {
71
+        if (!$language instanceof Language) {
72 72
             $language = self::getLanguage($language);
73 73
         }
74 74
 
@@ -80,8 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
 Highlighter::setDefaultFormatter(
82 82
     php_sapi_name() === 'cli' ?
83
-        new CliFormatter() :
84
-        new HtmlFormatter()
83
+        new CliFormatter() : new HtmlFormatter()
85 84
 );
86 85
 
87 86
 Highlighter::registerLanguage('Kadet\\Highlighter\\Language\\PhpLanguage', ['php']);
Please login to merge, or discard this patch.