iterable_cleanup()   A
last analyzed

Complexity

Conditions 4
Paths 3

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 4

Importance

Changes 0
Metric Value
cc 4
eloc 3
nc 3
nop 1
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Improved;
6
7
/**
8
 * Filter out elements with null value and/or null key from iterator.
9
 *
10
 * @param iterable $iterable
11
 * @return \Generator
12
 */
13 8
function iterable_cleanup(iterable $iterable): \Generator
0 ignored issues
show
introduced by
Function Improved\iterable_cleanup() has parameter $iterable with no value type specified in iterable type iterable.
Loading history...
introduced by
Function Improved\iterable_cleanup() return type has no value type specified in iterable type Generator.
Loading history...
14
{
15 7
    foreach ($iterable as $key => $value) {
16 6
        if (isset($key) && isset($value)) {
17 6
            yield $key => $value;
18
        }
19
    }
20
}
21