Passed
Branch factorize (4cfa74)
by Samuel
01:51
created

IntervalTransformer::validate()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 3
Ratio 50 %

Code Coverage

Tests 3
CRAP Score 4

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 3
loc 6
ccs 3
cts 3
cp 1
rs 9.2
cc 4
eloc 3
nc 2
nop 1
crap 4
1
<?php
2
3
namespace Recurrence\Rrule\Transformer;
4
5
use Recurrence\Model\Exception\InvalidRruleException;
6
use Recurrence\Rrule\Extractor\IntervalExtractor;
7
8
/**
9
 * Class IntervalTransformer
10
 * @package Recurrence\Rrule\Transformer
11
 */
12
class IntervalTransformer extends CountTransformer
13
{
14
15
    /**
16
     * @param array $values
17
     * @throws InvalidRruleException
18
     */
19
    protected function validate(array $values)
20
    {
21 1 View Code Duplication
        if (!isset($values[0]) || !is_numeric($values[0])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
22 1
            throw new InvalidRruleException(IntervalExtractor::RRULE_PARAMETER, ((isset($values[0]))? (string) $values[0] : ''));
23
        }
24 1
    }
25
}
26