Completed
Pull Request — master (#5)
by Carlos C
13:10
created

DataArray   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

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