_processInput($data); $data = json_decode(json_encode((array)$xml), true); $this->_data = array_replace_recursive( array_merge_recursive($this->_data, $data), $data); return $this; } /** * * process input * * @param $input * * @return null|\SimpleXMLElement */ protected function _processInput($input) { $xml = null; if ($input instanceof \SimpleXMLElement) { $xml = $input; } else if (file_exists($input)) { $xml = simplexml_load_file($input); } else { $xml = simplexml_load_string($input); } return $xml; } }