CountableTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 17
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A count() 0 8 2
1
<?php
2
/**
3
 * @copyright Zicht Online <http://zicht.nl>
4
 */
5
6
namespace Zicht\Itertools\lib\Traits;
7
8
trait CountableTrait
9
{
10
    /**
11
     * Count elements of an object
12
     *
13
     * @link http://php.net/manual/en/countable.count.php
14
     * @return int
15
     */
16 132
    public function count()
17
    {
18 132
        if ($this instanceof \Iterator) {
19 131
            return iterator_count($this);
20
        }
21
22 1
        return null;
23
    }
24
}
25