diff options
author | VirtualTam <virtualtam+github@flibidi.net> | 2017-03-04 20:28:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-04 20:28:38 +0100 |
commit | 236239be752a7bb24547237b5751ac4fcbc0e549 (patch) | |
tree | 6e1c0130ea30bf218b9a131f58f7224b6defde3f /application/config/ConfigManager.php | |
parent | cc30d749ab17be2bf0b623a16f8fa78ecfd5b57d (diff) | |
parent | 3c66e56435359dc678048193e8ee239d06f79b64 (diff) | |
download | Shaarli-236239be752a7bb24547237b5751ac4fcbc0e549.tar.gz Shaarli-236239be752a7bb24547237b5751ac4fcbc0e549.tar.zst Shaarli-236239be752a7bb24547237b5751ac4fcbc0e549.zip |
Merge pull request #788 from virtualtam/application/namespace/config
application: introduce the Shaarli\Config namespace
Diffstat (limited to 'application/config/ConfigManager.php')
-rw-r--r-- | application/config/ConfigManager.php | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/application/config/ConfigManager.php b/application/config/ConfigManager.php index a401887c..679a75b3 100644 --- a/application/config/ConfigManager.php +++ b/application/config/ConfigManager.php | |||
@@ -1,9 +1,5 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | namespace Shaarli\Config; | |
3 | // FIXME! Namespaces... | ||
4 | require_once 'ConfigIO.php'; | ||
5 | require_once 'ConfigJson.php'; | ||
6 | require_once 'ConfigPhp.php'; | ||
7 | 3 | ||
8 | /** | 4 | /** |
9 | * Class ConfigManager | 5 | * Class ConfigManager |
@@ -124,12 +120,12 @@ class ConfigManager | |||
124 | * @param bool $write Write the new setting in the config file, default false. | 120 | * @param bool $write Write the new setting in the config file, default false. |
125 | * @param bool $isLoggedIn User login state, default false. | 121 | * @param bool $isLoggedIn User login state, default false. |
126 | * | 122 | * |
127 | * @throws Exception Invalid | 123 | * @throws \Exception Invalid |
128 | */ | 124 | */ |
129 | public function set($setting, $value, $write = false, $isLoggedIn = false) | 125 | public function set($setting, $value, $write = false, $isLoggedIn = false) |
130 | { | 126 | { |
131 | if (empty($setting) || ! is_string($setting)) { | 127 | if (empty($setting) || ! is_string($setting)) { |
132 | throw new Exception('Invalid setting key parameter. String expected, got: '. gettype($setting)); | 128 | throw new \Exception('Invalid setting key parameter. String expected, got: '. gettype($setting)); |
133 | } | 129 | } |
134 | 130 | ||
135 | // During the ConfigIO transition, map legacy settings to the new ones. | 131 | // During the ConfigIO transition, map legacy settings to the new ones. |
@@ -177,7 +173,7 @@ class ConfigManager | |||
177 | * | 173 | * |
178 | * @throws MissingFieldConfigException: a mandatory field has not been provided in $conf. | 174 | * @throws MissingFieldConfigException: a mandatory field has not been provided in $conf. |
179 | * @throws UnauthorizedConfigException: user is not authorize to change configuration. | 175 | * @throws UnauthorizedConfigException: user is not authorize to change configuration. |
180 | * @throws IOException: an error occurred while writing the new config file. | 176 | * @throws \IOException: an error occurred while writing the new config file. |
181 | */ | 177 | */ |
182 | public function write($isLoggedIn) | 178 | public function write($isLoggedIn) |
183 | { | 179 | { |
@@ -366,7 +362,7 @@ class ConfigManager | |||
366 | /** | 362 | /** |
367 | * Exception used if a mandatory field is missing in given configuration. | 363 | * Exception used if a mandatory field is missing in given configuration. |
368 | */ | 364 | */ |
369 | class MissingFieldConfigException extends Exception | 365 | class MissingFieldConfigException extends \Exception |
370 | { | 366 | { |
371 | public $field; | 367 | public $field; |
372 | 368 | ||
@@ -385,7 +381,7 @@ class MissingFieldConfigException extends Exception | |||
385 | /** | 381 | /** |
386 | * Exception used if an unauthorized attempt to edit configuration has been made. | 382 | * Exception used if an unauthorized attempt to edit configuration has been made. |
387 | */ | 383 | */ |
388 | class UnauthorizedConfigException extends Exception | 384 | class UnauthorizedConfigException extends \Exception |
389 | { | 385 | { |
390 | /** | 386 | /** |
391 | * Construct exception. | 387 | * Construct exception. |