1 | <?php |
||
10 | class MergePrefix extends AbstractPass |
||
11 | { |
||
12 | /** |
||
13 | * {@inheritdoc} |
||
14 | */ |
||
15 | 5 | protected function processStrings(array $strings) |
|
25 | |||
26 | /** |
||
27 | * Get the number of leading elements common to all given strings |
||
28 | * |
||
29 | * @param array[] $strings |
||
30 | * @return integer |
||
31 | */ |
||
32 | 4 | protected function getPrefixLength(array $strings) |
|
43 | |||
44 | /** |
||
45 | * Return given strings grouped by their first element |
||
46 | * |
||
47 | * NOTE: assumes that this pass is run before the first element of any string could be replaced |
||
48 | * |
||
49 | * @param array[] $strings |
||
50 | * @return array[] |
||
51 | */ |
||
52 | 5 | protected function getStringsByPrefix(array $strings) |
|
62 | |||
63 | /** |
||
64 | * Merge given strings into a new single string |
||
65 | * |
||
66 | * @param array[] $strings |
||
67 | * @return array |
||
68 | */ |
||
69 | 4 | protected function mergeStrings(array $strings) |
|
80 | |||
81 | /** |
||
82 | * Test whether all given strings' elements match at given position |
||
83 | * |
||
84 | * @param array[] $strings |
||
85 | * @param integer $pos |
||
86 | * @return bool |
||
87 | */ |
||
88 | 3 | protected function stringsMatch(array $strings, $pos) |
|
101 | } |