Completed
Push — master ( bc8348...7e1aef )
by Barney
02:46
created

RequiresOuterIteratorTrait::testOuterIterator()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 13
rs 9.4285
c 1
b 0
f 0
cc 2
eloc 8
nc 2
nop 1
1
<?php
2
3
namespace Shrikeh\Collection;
4
5
use OuterIterator;
6
use Shrikeh\Collection\Exception\IncorrectInterface;
7
8
trait RequiresOuterIteratorTrait
9
{
10
    private static function testOuterIterator($class)
11
    {
12
        if (!$class instanceof OuterIterator) {
13
            $msg = 'class %s uses trait %s but it is not an %s';
14
            throw new IncorrectInterface(
15
                sprintf($msg,
16
                    __CLASS__,
17
                    __TRAIT__,
18
                    'OuterIterator'
19
                )
20
            );
21
        }
22
    }
23
}
24