Phalcon\Config\Adapter\Xml::__construct PHP Метод

__construct() публичный Метод

Phalcon\Config\Adapter\Xml constructor
public __construct ( string $filePath )
$filePath string
    public function __construct($filePath)
    {
        if (!extension_loaded('SimpleXML')) {
            throw new Exception("SimpleXML extension not loaded");
        }
        libxml_use_internal_errors(true);
        $data = simplexml_load_file($filePath, 'SimpleXMLElement', LIBXML_NOCDATA);
        foreach (libxml_get_errors() as $error) {
            /** @var \LibXMLError $error */
            switch ($error->code) {
                case LIBXML_ERR_WARNING:
                    trigger_error($error->message, E_USER_WARNING);
                    break;
                default:
                    throw new Exception($error->message);
            }
        }
        libxml_use_internal_errors(false);
        parent::__construct(json_decode(json_encode((array) $data), true));
    }