Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/phonenumber/tools/ |
Upload File : |
<?php namespace Bitrix\Main\PhoneNumber\Tools; class MetadataBuilder { protected $fileName; protected $parser; public function __construct($fileName) { if(!\Bitrix\Main\IO\File::isFileExists($fileName)) throw new \Bitrix\Main\ArgumentException('File is not found'); $this->fileName = $fileName; $this->parser = new \Bitrix\Main\PhoneNumber\Tools\GoogleMetadata\Root(); } public function build() { $xmlReader = new \XMLReader(); if ($xmlReader->open('file://'.$this->fileName) === false) { throw new \Bitrix\Main\SystemException("XMLReader could not open URI"); } // looking for the root element while ($xmlReader->read() && $xmlReader->nodeType !== \XMLReader::ELEMENT) ; $parsedData = $this->parser->parseElement($xmlReader, '/'); $xmlReader->close(); unset($xmlReader); return $parsedData['ROOT']['territory']; } }