Collection::isEmpty()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Dalen\OWLPacketInterceptor\Packet;
4
5
/**
6
 * Description of Collection
7
 *
8
 * @author danieleorler
9
 */
10
class Collection implements \JsonSerializable
11
{
12
    private $items = array();
13
    
14 9
    public function addItem($obj)
15
    {
16 9
        $this->items[] = $obj;
17 9
    }
18
    
19 2
    public function getItem($id)
20
    {
21 2
        return $this->items[$id];
22
    }
23
    
24 2
    public function size()
25
    {
26 2
        return count($this->items);
27
    }
28
    
29 1
    public function isEmpty()
30
    {
31 1
        return count($this->items) === 0;
32
    }
33
    
34 1
    public function getInnerArray()
35
    {
36 1
        return $this->items;
37
    }
38
39 1
    public function jsonSerialize()
40
    {
41 1
        return $this->items;
42
    }
43
}
44