XmlHandler   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 20
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A renderType() 0 3 1
A parsePath() 0 5 2
1
<?php
2
/**
3
 * Automation tool mixed with code generator for easier continuous development
4
 *
5
 * @link      https://github.com/hiqdev/hidev
6
 * @package   hidev
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hidev\handlers;
12
13
use hiqdev\php\collection\ArrayHelper;
14
15
/**
16
 * Handler for XML files.
17
 */
18
class XmlHandler extends TypeHandler
19
{
20
    protected $_xml;
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function renderType($data)
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

25
    public function renderType(/** @scrutinizer ignore-unused */ $data)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
26
    {
27
        return $this->_xml->asXML();
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function parsePath($path, $minimal = null)
34
    {
35
        $this->_xml = simplexml_load_file(file_exists($path) ? $path : $minimal);
36
37
        return ArrayHelper::toArray($this->_xml);
38
    }
39
}
40