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

DataDoubleLinkedList   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 6
c 2
b 0
f 0
lcom 1
cbo 1
dl 0
loc 46
ccs 15
cts 15
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
createStorageObject() 0 1 ?
A clear() 0 4 1
A isEmpty() 0 4 1
A toArray() 0 8 2
A count() 0 4 1
A getIterator() 0 4 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