ArrayCheckStep::process()   A
last analyzed

Complexity

Conditions 4
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 4

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
ccs 4
cts 4
cp 1
cc 4
nc 2
nop 2
crap 4
1
<?php
2
3
namespace Port\Steps\Step;
4
5
use Port\Exception\UnexpectedTypeException;
6
use Port\Steps\Step;
7
8
/**
9
 * @author Márk Sági-Kazár <[email protected]>
10
 */
11
class ArrayCheckStep implements Step
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 6
    public function process($item, callable $next)
17
    {
18 6
        if (!is_array($item) && !($item instanceof \ArrayAccess && $item instanceof \Traversable)) {
19 1
            throw new UnexpectedTypeException($item, 'array');
20
        }
21
22 5
        return $next($item);
23
    }
24
}
25