Total Complexity | 5 |
Total Lines | 26 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
7 | abstract class AbstractExtractor implements RruleExtractorInterface |
||
8 | { |
||
9 | public const RRULE_PARAMETER = ''; |
||
10 | public const RRULE_PATTERN = ''; |
||
11 | |||
12 | /** |
||
13 | * @throws InvalidRruleException |
||
14 | */ |
||
15 | public function extract(string $rRule): ?array |
||
16 | { |
||
17 | 1 | if (preg_match(sprintf('/%s=%s/', $this::RRULE_PARAMETER, $this::RRULE_PATTERN), $rRule, $matches)) { |
|
18 | 1 | return array_slice($matches, 1); |
|
19 | } |
||
20 | |||
21 | 1 | $this->throwExceptionOnInvalidParameter($rRule, $this::RRULE_PARAMETER); |
|
22 | |||
23 | 1 | return null; |
|
24 | } |
||
25 | |||
26 | /** |
||
27 | * @throws InvalidRruleException |
||
28 | */ |
||
29 | public function throwExceptionOnInvalidParameter(string $rRule, string $ruleKey): void |
||
33 | } |
||
34 | 1 | } |
|
36 |