1 | <?php declare(strict_types=1); |
||
13 | class VariableCG extends AbstractCG |
||
14 | { |
||
15 | /** string Regular expression named filter group */ |
||
16 | const PATTERN_FILTER_GROUP = 'filter'; |
||
17 | |||
18 | /** string Variable string filter pattern */ |
||
19 | const PATTER_FILTER = '/.*?:(?<'.self::PATTERN_FILTER_GROUP.'>[^}]+)/'; |
||
20 | |||
21 | /** string Regular expression named character group group */ |
||
22 | const PATTERN_GROUP = 'variable'; |
||
23 | |||
24 | /** string Regular expression matching character group */ |
||
25 | const PATTERN_REGEXP = '{.*?}'; |
||
26 | |||
27 | /** string Character group matching regexp pattern */ |
||
28 | const PATTERN = '(?<'.self::PATTERN_GROUP.'>'.self::PATTERN_REGEXP.')'; |
||
29 | |||
30 | /** @var string Variable character group filter string */ |
||
31 | protected $filter; |
||
32 | |||
33 | /** |
||
34 | * @inheritdoc |
||
35 | */ |
||
36 | 21 | public function __construct($string, $length = 0) |
|
42 | |||
43 | /** |
||
44 | * Get variable character group filter value. |
||
45 | * |
||
46 | * @return string Filter value or empty string |
||
47 | */ |
||
48 | 21 | protected function getFilter(): string |
|
56 | |||
57 | /** |
||
58 | * @inheritdoc |
||
59 | */ |
||
60 | 9 | protected function compareLength(AbstractCG $group): int |
|
87 | |||
88 | /** |
||
89 | * @return bool Return true if variable character group has filter |
||
90 | */ |
||
91 | 9 | protected function isFiltered(): bool |
|
95 | } |
||
96 |