Completed
Push — master ( 2f0783...0fb3d7 )
by Markus
03:33
created

ArrayStorage   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 86.67%

Importance

Changes 5
Bugs 1 Features 0
Metric Value
wmc 5
c 5
b 1
f 0
lcom 1
cbo 3
dl 0
loc 47
ccs 13
cts 15
cp 0.8667
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getFields() 0 4 1
A reader() 0 4 1
A writer() 0 4 1
A info() 0 8 1
1
<?php
2
namespace Mathielen\ImportEngine\Storage;
3
4
use Ddeboer\DataImport\Reader\ArrayReader;
5
use Ddeboer\DataImport\Writer\ArrayWriter;
6
7
class ArrayStorage implements StorageInterface
8
{
9
10
    private $array;
11
12 4
    public function __construct(array &$array)
13
    {
14 4
        $this->array = &$array;
15 4
    }
16
17
    public function getFields()
18
    {
19
        return $this->reader()->getFields();
20
    }
21
22
    /**
23
     * (non-PHPdoc)
24
     * @see \Mathielen\ImportEngine\Source\SourceInterface::reader()
25
     */
26 3
    public function reader()
27
    {
28 3
        return new ArrayReader($this->array);
29
    }
30
31
    /**
32
     * (non-PHPdoc)
33
     * @see \Mathielen\ImportEngine\Source\StorageInterface::writer()
34
     */
35 1
    public function writer()
36
    {
37 1
        return new ArrayWriter($this->array);
38
    }
39
40
    /**
41
     * (non-PHPdoc)
42
     * @see \Mathielen\ImportEngine\Source\SourceInterface::info()
43
     */
44 1
    public function info()
45
    {
46 1
        return new StorageInfo(array(
47 1
            'name' => 'Array Storage',
48 1
            'format' => 'Array Storage',
49 1
            'count' => count($this->reader())
50 1
        ));
51
    }
52
53
}
54