ArrayItemLogger   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 27.27%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 35
ccs 3
cts 11
cp 0.2727
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A doLog() 0 4 1
A doRemoveLog() 0 4 1
A getImportedItems() 0 8 2
1
<?php
2
3
namespace TreeHouse\IoBundle\Import\Log;
4
5
use TreeHouse\IoBundle\Entity\Import;
6
7
class ArrayItemLogger extends AbstractItemLogger
8
{
9
    /**
10
     * @var array
11
     */
12
    protected $items = [];
13
14
    /**
15
     * @inheritdoc
16
     */
17
    public function getImportedItems(Import $import)
18
    {
19
        $ident = $this->getLogIdent($import);
20
21
        foreach ($this->items[$ident] as $item) {
22
            yield $item;
23
        }
24
    }
25
26
    /**
27
     * @inheritdoc
28
     */
29 4
    protected function doLog($ident, $originalId, array $context)
30
    {
31 4
        $this->items[$ident][$originalId] = $context;
32 4
    }
33
34
    /**
35
     * @inheritdoc
36
     */
37
    protected function doRemoveLog($ident)
38
    {
39
        unset($this->items[$ident]);
40
    }
41
}
42