DataArray   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 34
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A isEmpty() 0 4 1
A toArray() 0 4 1
A clear() 0 4 1
A count() 0 4 1
A getIterator() 0 4 1
1
<?php
2
namespace GenericCollections\Internal;
3
4
/**
5
 * This is a internal class to implement a protected property $data
6
 * that works like the internal storage for classes on this package.
7
 *
8
 * It also contains small methods to work with the array as a variable,
9
 * not in its contains. This follow the StorageInterface
10
 *
11
 * @package GenericCollections\Abstracts
12
 */
13
abstract class DataArray implements StorageInterface
14
{
15
    /**
16
     * Local storage for members
17
     *
18
     * @var array
19
     */
20
    protected $data = [];
21
22 1
    public function isEmpty()
23
    {
24 1
        return (0 === count($this->data));
25
    }
26
27 16
    public function toArray()
28
    {
29 16
        return $this->data;
30
    }
31
32 1
    public function clear()
33
    {
34 1
        $this->data = [];
35 1
    }
36
37 15
    public function count()
38
    {
39 15
        return count($this->data);
40
    }
41
42 1
    public function getIterator()
43
    {
44 1
        return new \ArrayIterator($this->data);
45
    }
46
}
47