ArrayWrite   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 28
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A pass() 0 6 1
1
<?php
2
declare(strict_types=1);
3
4
namespace SlayerBirden\DataFlow\Writer;
5
6
use SlayerBirden\DataFlow\DataBagInterface;
7
use SlayerBirden\DataFlow\PipeInterface;
8
use SlayerBirden\DataFlow\IdentificationTrait;
9
10
class ArrayWrite implements PipeInterface
11
{
12
    use IdentificationTrait;
13
    /**
14
     * @var array
15
     */
16
    private $localStorage;
17
    /**
18
     * @var string
19
     */
20
    private $identifier;
21
22 1
    public function __construct(string $id, array &$localStorage)
23
    {
24 1
        $this->identifier = $id;
25 1
        $this->localStorage = &$localStorage;
26 1
    }
27
28
    /**
29
     * @inheritdoc
30
     */
31 1
    public function pass(DataBagInterface $dataBag): DataBagInterface
32
    {
33 1
        $this->localStorage[] = $dataBag->toArray();
34
35 1
        return $dataBag;
36
    }
37
}
38