Assert::isIterable()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
cc 3
eloc 3
nc 2
nop 2
crap 3
1
<?php
2
3
namespace Issei\StreamedCsvResponse;
4
5
/**
6
 * Assertion.
7
 *
8
 * {@internal Don't use this in user-land code }}
9
 *
10
 * @author Issei Murasawa <[email protected]>
11
 */
12
final class Assert
13
{
14
    /**
15
     * Throws an \InvalidArgumentException if given value is not iterable.
16
     *
17
     * @param mixed  $value
18
     * @param string $message
19
     */
20 15
    public static function isIterable($value, $message)
21
    {
22 15
        if (!$value instanceof \Traversable && !is_array($value)) {
23 2
            throw new \InvalidArgumentException($message);
24
        }
25 13
    }
26
27
    private function __construct() {}
28
}
29