Соответсвие расширения файла и формата

This commit is contained in:
Podlesnov Phedor 2021-07-08 19:43:27 +03:00
parent 61bc5e5709
commit 9aa5f0fa09

View file

@ -16,7 +16,10 @@ class Settings extends Collection
public function __construct ($file = null, $format = false) public function __construct ($file = null, $format = false)
{ {
$this->format = $format ? $format : pathinfo($file, PATHINFO_EXTENSION); $fileFormat = ['theme' => 'json'];
$extname = pathinfo($file, PATHINFO_EXTENSION);
$this->format = $format ? $format : Arr::get($fileFormat, $extname, $extname);
$this->file = $file; $this->file = $file;
} }