XMLContextReader::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 4 Features 0
Metric Value
c 4
b 4
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace PEIP\Context;
4
5
/*
6
 * To change this template, choose Tools | Templates
7
 * and open the template in the editor.
8
 */
9
10
/*
11
 * Description of XMLContextReader
12
 *
13
 * @author timo
14
 */
15
use PEIP\Translator\XMLArrayTranslator;
16
17
class XMLContextReader extends \PEIP\ABS\Base\Connectable
18
{
19
    //put your code here
20
21
    protected $config;
22
23
    public function __construct($config)
24
    {
25
        $this->config = ($config);
26
    }
27
28
    public function read()
29
    {
30
        $iterator = new \SimpleXMLIterator($this->config);
31
        $iterator->rewind();
32
        while ($iterator->valid()) {
33
            $arrayNode = XMLArrayTranslator::translate($iterator->current()->asXML());
34
            $this->doFireEvent('read_node', ['NODE' => $arrayNode]);
35
            $iterator->next();
36
        }
37
38
        foreach ($iterator as $xmlNode) {
0 ignored issues
show
Unused Code introduced by
This foreach statement is empty and can be removed.

This check looks for foreach loops that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

Consider removing the loop.

Loading history...
39
        }
40
        $this->config = [];
41
    }
42
}
43