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

DataDoubleLinkedList::isEmpty()   A

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 namespace GenericCollections\Internal;
2
3
abstract class DataDoubleLinkedList implements StorageInterface
4
{
5
    /**
6
     * Local storage for members
7
     *
8
     * @var DoubleLinkedList
9
     */
10
    protected $storage;
11
12
    /**
13
     * Create a new empty DoubleLinkedList and set it
14
     * on protected variable $storage
15
     *
16
     * @return void
17
     */
18
    abstract protected function createStorageObject();
19
20 3
    public function clear()
21
    {
22 3
        $this->storage->clear();
23 3
    }
24
25 78
    public function isEmpty()
26
    {
27 78
        return $this->storage->isEmpty();
28
    }
29
30 66
    public function toArray()
31
    {
32 66
        $array = [];
33 66
        foreach ($this->storage as $element) {
34 63
            $array[] = $element;
35 66
        }
36 66
        return $array;
37
    }
38
39 87
    public function count()
40
    {
41 87
        return $this->storage->count();
42
    }
43
44 3
    public function getIterator()
45
    {
46 3
        return new \IteratorIterator($this->storage);
47
    }
48
}
49