XmlHandler::parsePath()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 1
nop 2
dl 0
loc 5
ccs 0
cts 4
cp 0
crap 6
rs 10
c 0
b 0
f 0
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