@@ -1,17 +1,17 @@ |
||
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 |
@@ -108,6 +108,9 @@ discard block |
||
108 | 108 | return $this->_parser->process($tokens); |
109 | 109 | } |
110 | 110 | |
111 | + /** |
|
112 | + * @param string $source |
|
113 | + */ |
|
111 | 114 | public function tokenize($source, $additional = [], $offset = 0, $embedded = false) |
112 | 115 | { |
113 | 116 | return new TokenIterator( |
@@ -145,7 +148,7 @@ discard block |
||
145 | 148 | /** |
146 | 149 | * @param bool $embedded |
147 | 150 | * |
148 | - * @return Rule[] |
|
151 | + * @return \Generator |
|
149 | 152 | */ |
150 | 153 | private function _rules($embedded = false) |
151 | 154 | { |
@@ -177,7 +180,7 @@ discard block |
||
177 | 180 | * |
178 | 181 | * @param $embedded |
179 | 182 | * |
180 | - * @return Rule|\Kadet\Highlighter\Parser\Rule[] |
|
183 | + * @return Rule |
|
181 | 184 | */ |
182 | 185 | public function getEnds($embedded = false) |
183 | 186 | { |
@@ -150,8 +150,8 @@ |
||
150 | 150 | private function _rules($embedded = false) |
151 | 151 | { |
152 | 152 | $rules = clone $this->rules; |
153 | - if(is_bool($embedded)) { |
|
154 | - $rules->addMany(['language.'.$this->getIdentifier() => $this->getEnds($embedded)]); |
|
153 | + if (is_bool($embedded)) { |
|
154 | + $rules->addMany(['language.' . $this->getIdentifier() => $this->getEnds($embedded)]); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | foreach ($rules->all() as $rule) { |
@@ -1,17 +1,17 @@ |
||
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 |
@@ -67,11 +67,11 @@ |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | public function setContext($context) { |
70 | - if(is_array($context)) { |
|
70 | + if (is_array($context)) { |
|
71 | 71 | $this->_validator = new Validator($context); |
72 | - } elseif(is_callable($context)) { |
|
72 | + } elseif (is_callable($context)) { |
|
73 | 73 | $this->_validator = new DelegateValidator($context); |
74 | - }elseif($context instanceof Validator) { |
|
74 | + }elseif ($context instanceof Validator) { |
|
75 | 75 | $this->_validator = $context; |
76 | 76 | } else { |
77 | 77 | throw new \InvalidArgumentException('$context must be valid Validator'); |
@@ -71,7 +71,7 @@ |
||
71 | 71 | $this->_validator = new Validator($context); |
72 | 72 | } elseif(is_callable($context)) { |
73 | 73 | $this->_validator = new DelegateValidator($context); |
74 | - }elseif($context instanceof Validator) { |
|
74 | + } elseif($context instanceof Validator) { |
|
75 | 75 | $this->_validator = $context; |
76 | 76 | } else { |
77 | 77 | throw new \InvalidArgumentException('$context must be valid Validator'); |
@@ -1,17 +1,17 @@ |
||
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 |
@@ -1,17 +1,17 @@ |
||
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 |
@@ -1,17 +1,17 @@ |
||
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 |
@@ -1,17 +1,17 @@ |
||
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 |
@@ -113,7 +113,7 @@ |
||
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
116 | - * @param mixed $class |
|
116 | + * @param string $class |
|
117 | 117 | * |
118 | 118 | * @throws \InvalidArgumentException |
119 | 119 | */ |
@@ -1,17 +1,17 @@ |
||
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 |
@@ -1,17 +1,17 @@ |
||
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 |
@@ -1,17 +1,17 @@ |
||
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 |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @param $styles |
36 | 36 | */ |
37 | 37 | public function __construct($styles = false) { |
38 | - $this->_styles = $styles ?: include __DIR__.'/../Styles/Cli/Default.php'; |
|
38 | + $this->_styles = $styles ?: include __DIR__ . '/../Styles/Cli/Default.php'; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | public function format(TokenIterator $tokens) |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | $last = $token->pos; |
57 | 57 | } |
58 | - $result .= substr($source, $last).Console::reset(); |
|
58 | + $result .= substr($source, $last) . Console::reset(); |
|
59 | 59 | |
60 | 60 | return $result; |
61 | 61 | } |