Избавляемся от статических классов и синглтонов

This commit is contained in:
CORP\phedor 2018-03-27 12:23:58 +03:00
parent 77fa3dbd5e
commit 805fb6654d
11 changed files with 177 additions and 309 deletions

View file

@ -34,7 +34,7 @@ class Settings extends Collection
if ($this->format == 'json') {
$settings = json_decode(File::getContents($this->file), true);
} else {
include ($this->file);
$settings = include ($this->file);
}
if (!is_array($settings)) {
@ -165,7 +165,7 @@ class Settings extends Collection
$result = json_encode($this->data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
} else {
$result = var_export($this->data, true);
$result = "<?php\n\$settings = ".$result.";\n?>";
$result = "<?php\nreturn ".$result.";\n?>";
}
file_put_contents (($file) ? $file : $this->file, $result);
}