1 | <?php declare(strict_types = 1); |
||
17 | class StringConditionTree |
||
18 | { |
||
19 | /** Tree node root element identifier, needed for recursion */ |
||
20 | const ROOT_NAME = ''; |
||
21 | |||
22 | /** Final tree node branch identifier */ |
||
23 | const SELF_NAME = '@self'; |
||
24 | |||
25 | /** String parameter start marker */ |
||
26 | const PARAMETER_START = '{'; |
||
27 | |||
28 | /** String parameter end marker */ |
||
29 | const PARAMETER_END = '}'; |
||
30 | |||
31 | /** Parameter sorting length value for counting */ |
||
32 | const PARAMETER_COF = 2000; |
||
33 | |||
34 | /** @var TreeNode Resulting internalCollection for debugging */ |
||
35 | protected $debug; |
||
36 | |||
37 | /** @var array Collection of string string => identifier */ |
||
38 | protected $source; |
||
39 | |||
40 | /** @var string Parametrized string start marker */ |
||
41 | protected $parameterStartMarker = self::PARAMETER_START; |
||
42 | |||
43 | /** @var string Parametrized string end marker */ |
||
44 | protected $parameterEndMarker = self::PARAMETER_END; |
||
45 | |||
46 | /** |
||
47 | * StringConditionTree constructor. |
||
48 | * |
||
49 | * @param string $parameterStartMarker Parametrized string start marker |
||
50 | * @param string $parameterEndMarker Parametrized string end marker |
||
51 | */ |
||
52 | 1 | public function __construct( |
|
59 | |||
60 | /** |
||
61 | * Build similarity strings tree. |
||
62 | * |
||
63 | * @param array $input Collection of strings |
||
64 | * |
||
65 | * @return TreeNode Resulting similarity strings tree |
||
66 | */ |
||
67 | 1 | public function process(array $input): TreeNode |
|
78 | |||
79 | /** |
||
80 | * @param StructureCollection[] $collection |
||
81 | */ |
||
82 | 1 | protected function processor(array $collection, TreeNode $parent, string $parentPrefix = ''): void |
|
93 | } |
||
94 |