Conditions | 5 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
63 | public function toArray() |
||
64 | { |
||
65 | $local = new LocalFile(); |
||
66 | $array = []; |
||
67 | if (self::TYPE_INI === $this->_type) { |
||
68 | foreach ($local->linesGenerator($this->_file, true) as $line) { |
||
69 | list($name, $value) = Arrays::lists(explode('=', $line), 2, function ($row) {return trim($row);}); |
||
70 | $array[$name] = $value; |
||
71 | } |
||
72 | } elseif (self::TYPE_JSON === $this->_type) { |
||
73 | $content = $local->getFileContent($this->_file); |
||
74 | $array = Json::decode($content); |
||
75 | } elseif (self::TYPE_XML === $this->_type) { |
||
76 | $content = $local->getFileContent($this->_file); |
||
77 | $array = Xml::toArray($content); |
||
78 | } |
||
79 | return $array; |
||
80 | } |
||
82 |