load($file)) { throw new \RuntimeException('ERROR: Cannot load vocations.xml - the file is malformed. Check the file with xml syntax validator.'); } foreach($vocationsXML->getElementsByTagName('vocation') as $vocation) { $id = $vocation->getAttribute('id'); $this->vocations[$id] = $vocation->getAttribute('name'); $fromVocation = (int) $vocation->getAttribute('fromvoc'); $this->vocationsFrom[$id] = $fromVocation; } } public function get(): array { return $this->vocations; } public function getFrom(): array { return $this->vocationsFrom; } }