Total Complexity | 5 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
9 | class ArrayWriter implements WriterInterface |
||
10 | { |
||
11 | /** |
||
12 | * @var array |
||
13 | */ |
||
14 | protected $outItems; |
||
15 | |||
16 | /** |
||
17 | * ArrayWriter constructor. |
||
18 | * @param $arrayToWrite |
||
19 | */ |
||
20 | public function __construct(&$arrayToWrite) |
||
21 | { |
||
22 | if (!is_array($arrayToWrite)) { |
||
23 | $arrayToWrite = []; |
||
24 | } |
||
25 | $this->outItems = &$arrayToWrite; |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * |
||
30 | */ |
||
31 | public function prepare() |
||
33 | //do nothing |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @param array $item |
||
38 | */ |
||
39 | public function writeItem(array $item) |
||
40 | { |
||
41 | $this->outItems[] = $item; |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * |
||
46 | */ |
||
47 | public function finish() |
||
49 | //do nothing |
||
50 | } |
||
51 | } |
||
52 |