Completed
Push — refactoring ( bfbba7...4b6f46 )
by Issei
02:22
created

Assert   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 21
ccs 4
cts 6
cp 0.6667
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isIterable() 0 6 3
A __construct() 0 3 1
1
<?php
2
3
namespace Issei;
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
     * @return bool
21
     */
22 15
    public static function isIterable($value, $message)
23
    {
24 15
        if (!$value instanceof \Traversable && !is_array($value)) {
25 2
            throw new \InvalidArgumentException($message);
26
        }
27 13
    }
28
29
    private function __construct()
30
    {
31
    }
32
}
33