Completed
Push — master ( df194f...6edc14 )
by Samuel
13s
created

IntervalTransformer::transform()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
namespace Recurrence\RruleTransformer;
4
5
/**
6
 * Class IntervalTransformer
7
 * @package Recurrence\RruleTransformer
8
 */
9
class IntervalTransformer implements TransformerInterface
10
{
11
    /**
12
     * @param string $rRule
13
     * @return integer
14
     */
15
    public function transform($rRule)
16
    {
17
        if (preg_match('/INTERVAL=([0-9]+)/', $rRule, $matches)) {
18
            return (int) $matches[1];
19
        }
20
21
        return null;
22
    }
23
}
24