/** * @param $file * * @throws \Exception */ public static function construct($file) { if (file_exists($file)) { self::$xml = new SimpleXMLElement($file, 0, True); self::$file = $file; } else { if (file_put_contents($file, '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<config>' . "\n" . '</config>')) { self::$xml = new SimpleXMLElement($file, 0, True); self::$file = $file; } else { throw new Exception($file . ' dosyası oluşturulamıyor. Yazma izinlerini kontrol ediniz'); } } }