1 | <?php declare(strict_types=1); |
||
13 | class Structure extends IterableStructure |
||
14 | { |
||
15 | /** array Supported character group types */ |
||
16 | const CG_TYPES = [ |
||
17 | VariableFixedCG::class, |
||
18 | VariableCG::class, |
||
19 | FixedCG::class, |
||
20 | ]; |
||
21 | |||
22 | /** @var string Input string */ |
||
23 | public $string; |
||
24 | |||
25 | /** |
||
26 | * Create string character group structure from string string. |
||
27 | * |
||
28 | * @param string $input Input string for string character group structure |
||
29 | */ |
||
30 | 19 | public function __construct(string $input) |
|
46 | |||
47 | /** |
||
48 | * Compare structure character groups. |
||
49 | * |
||
50 | * @param Structure $structure Compared string structure group |
||
51 | * |
||
52 | * @return int Comparison result |
||
53 | */ |
||
54 | 17 | public function compare(Structure $structure): int |
|
75 | |||
76 | /** |
||
77 | * Get longest common prefix between strings. |
||
78 | * |
||
79 | * @param Structure $compared Compared character group structure |
||
80 | * |
||
81 | * @return string Strings Longest common prefix or empty string |
||
82 | * |
||
83 | */ |
||
84 | 2 | public function getCommonPrefix(Structure $compared) |
|
110 | |||
111 | /** |
||
112 | * Define shortest structure. |
||
113 | * |
||
114 | * @param Structure $compared Structure to compare |
||
115 | * |
||
116 | * @return Structure Shortest structure |
||
117 | */ |
||
118 | 2 | private function getShortestStructure(Structure $compared): Structure |
|
123 | } |
||
124 |