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