DataArray::toArray()   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 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 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