Conditions | 3 |
Paths | 4 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | 4 | public function __construct( $iterator, callable $callback ) { |
|
30 | |||
31 | 4 | if ( is_array( $iterator ) ) { |
|
32 | 2 | $iterator = new ArrayIterator( $iterator ); |
|
33 | 2 | } |
|
34 | |||
35 | 4 | if ( !$iterator instanceof Iterator ) { |
|
36 | 1 | throw new RuntimeException( "CallbackIterator expected an Iterator" ); |
|
37 | } |
||
38 | |||
39 | 3 | parent::__construct( $iterator ); |
|
40 | 3 | $this->callback = $callback; |
|
41 | 3 | } |
|
42 | |||
53 |