Completed
Push — master ( f6cc4f...20183c )
by Andrii
03:46
created

src/handlers/XmlHandler.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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
The parameter $data is not used and could be removed.

This check looks from 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