XMLContextReader   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 6
Bugs 5 Features 0
Metric Value
wmc 4
c 6
b 5
f 0
lcom 1
cbo 2
dl 0
loc 26
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A read() 0 14 3
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