Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 3.072 |
Changes | 0 |
1 | <?php |
||
17 | public function transform($rRule) |
||
18 | { |
||
19 | 1 | if (preg_match('/FREQ=([a-zA-Z]+)/', $rRule, $matches)) { |
|
20 | 1 | return new Frequency($matches[1]); |
|
21 | } |
||
22 | |||
23 | // If there is a FREQ option but transformer was not able to get it, assume it was an invalid option |
||
24 | 1 | if (preg_match('/FREQ=/', $rRule, $matches)) { |
|
25 | throw new \InvalidArgumentException('RRULE invalid [FREQ] option'); |
||
26 | } |
||
27 | |||
28 | 1 | throw new \InvalidArgumentException('RRULE required [FREQ] option'); |
|
29 | } |
||
30 | } |
||
31 |