Completed
Push — master ( a67fbc...6c0a08 )
by Samuel
11s
created

FreqTransformer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 15
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 8 2
1
<?php
2
3
namespace Recurrence\RruleTransformer;
4
5
use Recurrence\Frequency;
6
7
class FreqTransformer implements TransformerInterface
8
{
9
    /**
10
     * @param string $rRule
11
     * @return Frequency
12
     */
13
    public function transform($rRule)
14
    {
15
        if(preg_match('/FREQ=([a-zA-Z]+)/', $rRule, $matches)) {
16
            return new Frequency($matches[1]);
17
        }
18
19
        throw new \InvalidArgumentException('RRULE required [FREQ] option');
20
    }
21
}