@@ -13,16 +13,16 @@ discard block |
||
13 | 13 | class MergeSuffix extends AbstractPass |
14 | 14 | { |
15 | 15 | /** |
16 | - * {@inheritdoc} |
|
17 | - */ |
|
16 | + * {@inheritdoc} |
|
17 | + */ |
|
18 | 18 | protected function canRun(array $strings) |
19 | 19 | { |
20 | 20 | return (count($strings) > 1 && $this->hasMatchingSuffix($strings)); |
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
24 | - * {@inheritdoc} |
|
25 | - */ |
|
24 | + * {@inheritdoc} |
|
25 | + */ |
|
26 | 26 | protected function runPass(array $strings) |
27 | 27 | { |
28 | 28 | $newString = []; |
@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
40 | - * Test whether all given strings have the same last element |
|
41 | - * |
|
42 | - * @param array[] $strings |
|
43 | - * @return bool |
|
44 | - */ |
|
40 | + * Test whether all given strings have the same last element |
|
41 | + * |
|
42 | + * @param array[] $strings |
|
43 | + * @return bool |
|
44 | + */ |
|
45 | 45 | protected function hasMatchingSuffix(array $strings) |
46 | 46 | { |
47 | 47 | $suffix = end($strings[1]); |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | - * Remove the last element of every string |
|
61 | - * |
|
62 | - * @param array[] $strings Original strings |
|
63 | - * @return array[] Processed strings |
|
64 | - */ |
|
60 | + * Remove the last element of every string |
|
61 | + * |
|
62 | + * @param array[] $strings Original strings |
|
63 | + * @return array[] Processed strings |
|
64 | + */ |
|
65 | 65 | protected function pop(array $strings) |
66 | 66 | { |
67 | 67 | $cnt = count($strings); |
@@ -12,19 +12,19 @@ discard block |
||
12 | 12 | class Serializer |
13 | 13 | { |
14 | 14 | /** |
15 | - * @var Escaper |
|
16 | - */ |
|
15 | + * @var Escaper |
|
16 | + */ |
|
17 | 17 | protected $escaper; |
18 | 18 | |
19 | 19 | /** |
20 | - * @var OutputInterface |
|
21 | - */ |
|
20 | + * @var OutputInterface |
|
21 | + */ |
|
22 | 22 | protected $output; |
23 | 23 | |
24 | 24 | /** |
25 | - * @param OutputInterface $output |
|
26 | - * @param Escaper $escaper |
|
27 | - */ |
|
25 | + * @param OutputInterface $output |
|
26 | + * @param Escaper $escaper |
|
27 | + */ |
|
28 | 28 | public function __construct(OutputInterface $output, Escaper $escaper) |
29 | 29 | { |
30 | 30 | $this->escaper = $escaper; |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
35 | - * Serialize given strings into a regular expression |
|
36 | - * |
|
37 | - * @param array[] $strings |
|
38 | - * @return string |
|
39 | - */ |
|
35 | + * Serialize given strings into a regular expression |
|
36 | + * |
|
37 | + * @param array[] $strings |
|
38 | + * @return string |
|
39 | + */ |
|
40 | 40 | public function serializeStrings(array $strings) |
41 | 41 | { |
42 | 42 | $info = $this->analyzeStrings($strings); |
@@ -52,17 +52,17 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
55 | - * Analyze given strings to determine how to serialize them |
|
56 | - * |
|
57 | - * The returned array may contains any of the following elements: |
|
58 | - * |
|
59 | - * - (string) quantifier Either '' or '?' |
|
60 | - * - (array) chars List of values from single-char strings |
|
61 | - * - (array) strings List of multi-char strings |
|
62 | - * |
|
63 | - * @param array[] $strings |
|
64 | - * @return array |
|
65 | - */ |
|
55 | + * Analyze given strings to determine how to serialize them |
|
56 | + * |
|
57 | + * The returned array may contains any of the following elements: |
|
58 | + * |
|
59 | + * - (string) quantifier Either '' or '?' |
|
60 | + * - (array) chars List of values from single-char strings |
|
61 | + * - (array) strings List of multi-char strings |
|
62 | + * |
|
63 | + * @param array[] $strings |
|
64 | + * @return array |
|
65 | + */ |
|
66 | 66 | protected function analyzeStrings(array $strings) |
67 | 67 | { |
68 | 68 | $info = ['quantifier' => '']; |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
88 | - * Build the list of alternations based on given info |
|
89 | - * |
|
90 | - * @param array $info |
|
91 | - * @return string[] |
|
92 | - */ |
|
88 | + * Build the list of alternations based on given info |
|
89 | + * |
|
90 | + * @param array $info |
|
91 | + * @return string[] |
|
92 | + */ |
|
93 | 93 | protected function buildAlternations(array $info) |
94 | 94 | { |
95 | 95 | $alternations = []; |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
109 | - * Return the portion of strings that are composed of a single character |
|
110 | - * |
|
111 | - * @param array[] |
|
112 | - * @return array String key => codepoint |
|
113 | - */ |
|
109 | + * Return the portion of strings that are composed of a single character |
|
110 | + * |
|
111 | + * @param array[] |
|
112 | + * @return array String key => codepoint |
|
113 | + */ |
|
114 | 114 | protected function getChars(array $strings) |
115 | 115 | { |
116 | 116 | $chars = []; |
@@ -126,11 +126,11 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
129 | - * Get the list of ranges that cover all given values |
|
130 | - * |
|
131 | - * @param integer[] $values Ordered list of values |
|
132 | - * @return array[] List of ranges in the form [start, end] |
|
133 | - */ |
|
129 | + * Get the list of ranges that cover all given values |
|
130 | + * |
|
131 | + * @param integer[] $values Ordered list of values |
|
132 | + * @return array[] List of ranges in the form [start, end] |
|
133 | + */ |
|
134 | 134 | protected function getRanges(array $values) |
135 | 135 | { |
136 | 136 | $i = 0; |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
159 | - * Test whether a string is optional and has more than one character |
|
160 | - * |
|
161 | - * @param array $info |
|
162 | - * @return bool |
|
163 | - */ |
|
159 | + * Test whether a string is optional and has more than one character |
|
160 | + * |
|
161 | + * @param array $info |
|
162 | + * @return bool |
|
163 | + */ |
|
164 | 164 | protected function isOneOptionalString(array $info) |
165 | 165 | { |
166 | 166 | // Test whether the first string has a quantifier and more than one element |
@@ -168,11 +168,11 @@ discard block |
||
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
171 | - * Serialize a given list of values into a character class |
|
172 | - * |
|
173 | - * @param integer[] $values |
|
174 | - * @return string |
|
175 | - */ |
|
171 | + * Serialize a given list of values into a character class |
|
172 | + * |
|
173 | + * @param integer[] $values |
|
174 | + * @return string |
|
175 | + */ |
|
176 | 176 | protected function serializeCharacterClass(array $values) |
177 | 177 | { |
178 | 178 | $expr = '['; |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
197 | - * Serialize a given string into a regular expression |
|
198 | - * |
|
199 | - * @param array $string |
|
200 | - * @return string |
|
201 | - */ |
|
197 | + * Serialize a given string into a regular expression |
|
198 | + * |
|
199 | + * @param array $string |
|
200 | + * @return string |
|
201 | + */ |
|
202 | 202 | protected function serializeString(array $string) |
203 | 203 | { |
204 | 204 | $expr = ''; |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | class Utf8 implements InputInterface |
13 | 13 | { |
14 | 14 | /** |
15 | - * {@inheritdoc} |
|
16 | - */ |
|
15 | + * {@inheritdoc} |
|
16 | + */ |
|
17 | 17 | public function split($string) |
18 | 18 | { |
19 | 19 | if (preg_match_all('(.)us', $string, $matches) === false) |
@@ -25,22 +25,22 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
28 | - * Convert a list of UTF-8 characters to a list of Unicode codepoint |
|
29 | - * |
|
30 | - * @param string[] $chars |
|
31 | - * @return integer[] |
|
32 | - */ |
|
28 | + * Convert a list of UTF-8 characters to a list of Unicode codepoint |
|
29 | + * |
|
30 | + * @param string[] $chars |
|
31 | + * @return integer[] |
|
32 | + */ |
|
33 | 33 | protected function charsToCodepoints(array $chars) |
34 | 34 | { |
35 | 35 | return array_map([$this, 'cp'], $chars); |
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
39 | - * Compute and return the Unicode codepoint for given UTF-8 char |
|
40 | - * |
|
41 | - * @param string $char UTF-8 char |
|
42 | - * @return integer |
|
43 | - */ |
|
39 | + * Compute and return the Unicode codepoint for given UTF-8 char |
|
40 | + * |
|
41 | + * @param string $char UTF-8 char |
|
42 | + * @return integer |
|
43 | + */ |
|
44 | 44 | protected function cp($char) |
45 | 45 | { |
46 | 46 | $cp = ord($char[0]); |