Избавляемся от статических классов и синглтонов
This commit is contained in:
parent
77fa3dbd5e
commit
805fb6654d
11 changed files with 177 additions and 309 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue