/** * @param $destinationsXmlPath string Specifies the destinations xml file path * @throws \Exception */ public function __construct($destinationsXmlPath) { if (!file_exists($destinationsXmlPath)) { throw new \Exception("`{$destinationsXmlPath}` file not found."); } $xml = file_get_contents($destinationsXmlPath); $reader = SimpleXmlReader::openFromString($xml); $this->_destinations = $reader->path('destinations/destination'); }
/** * @param $taxonomyXmlPath string Specifies the taxonomy xml file path * @throws \Exception */ public function __construct($taxonomyXmlPath) { if (!file_exists($taxonomyXmlPath)) { throw new \Exception("`{$taxonomyXmlPath}` file not found."); } if (!is_readable($taxonomyXmlPath)) { throw new \Exception("`{$taxonomyXmlPath}` file not readable."); } $xml = file_get_contents($taxonomyXmlPath); $reader = SimpleXmlReader::openFromString($xml); $node = $reader->path('taxonomies/taxonomy'); $node->next(); $taxonomy = $node->current(); $this->name = $taxonomy->taxonomy_name->__toString(); $reader = SimpleXmlReader::openFromString($xml); $node = $reader->path('taxonomies/taxonomy/node'); $node->next(); while ($node->valid()) { $this->_rootNodes[] = $node->current(); $node->next(); } $this->memorizeNodeStructure(); }