iterable_walk()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 3
nc 3
nop 1
dl 0
loc 8
ccs 3
cts 3
cp 1
crap 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Improved;
6
7
/**
8
 * Traverse over the iterator, not capturing the values.
9
 * This is particularly useful after `iterable_apply()`.
10
 *
11
 * @param iterable $iterable
12
 * @return void
13
 */
14
function iterable_walk(iterable $iterable): void
0 ignored issues
show
introduced by
Function Improved\iterable_walk() has parameter $iterable with no value type specified in iterable type iterable.
Loading history...
15
{
16 8
    if (is_array($iterable)) {
17 1
        return; // No point walking over an array
18
    }
19
20
    /** @noinspection ALL */
21 7
    foreach ($iterable as $_) {
22
        // nop
23
    }
24
}
25