1 | <?php |
||
13 | class CoalesceOptionalStrings extends AbstractPass |
||
14 | { |
||
15 | /** |
||
16 | * {@inheritdoc} |
||
17 | */ |
||
18 | 7 | protected function canRun(array $strings) |
|
22 | |||
23 | /** |
||
24 | * {@inheritdoc} |
||
25 | */ |
||
26 | 7 | protected function runPass(array $strings) |
|
42 | |||
43 | /** |
||
44 | * Build the final list of coalesced strings |
||
45 | * |
||
46 | * @param array[] $prefixStrings |
||
47 | * @param array $suffix |
||
48 | * @return array[] |
||
49 | */ |
||
50 | 4 | protected function buildCoalescedStrings(array $prefixStrings, array $suffix) |
|
70 | |||
71 | /** |
||
72 | * Build the list of strings used as prefix |
||
73 | * |
||
74 | * @param array[] $strings |
||
75 | * @return array[] |
||
76 | */ |
||
77 | 4 | protected function buildPrefix(array $strings) |
|
89 | |||
90 | /** |
||
91 | * Build a list of strings that matches any given strings or nothing |
||
92 | * |
||
93 | * Will unpack groups of single characters |
||
94 | * |
||
95 | * @param array[] $strings |
||
96 | * @return array[] |
||
97 | */ |
||
98 | 7 | protected function buildSuffix(array $strings) |
|
118 | |||
119 | /** |
||
120 | * Get the list of potential prefix strings grouped by identical suffix |
||
121 | * |
||
122 | * @param array[] $strings |
||
123 | * @return array |
||
124 | */ |
||
125 | 7 | protected function getPrefixGroups(array $strings) |
|
138 | } |