aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/config/ConfigJson.php
diff options
context:
space:
mode:
authorVirtualTam <virtualtam+github@flibidi.net>2017-03-04 20:28:38 +0100
committerGitHub <noreply@github.com>2017-03-04 20:28:38 +0100
commit236239be752a7bb24547237b5751ac4fcbc0e549 (patch)
tree6e1c0130ea30bf218b9a131f58f7224b6defde3f /application/config/ConfigJson.php
parentcc30d749ab17be2bf0b623a16f8fa78ecfd5b57d (diff)
parent3c66e56435359dc678048193e8ee239d06f79b64 (diff)
downloadShaarli-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/ConfigJson.php')
-rw-r--r--application/config/ConfigJson.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/application/config/ConfigJson.php b/application/config/ConfigJson.php
index 6b5d73f1..30908d90 100644
--- a/application/config/ConfigJson.php
+++ b/application/config/ConfigJson.php
@@ -1,4 +1,5 @@
1<?php 1<?php
2namespace Shaarli\Config;
2 3
3/** 4/**
4 * Class ConfigJson (ConfigIO implementation) 5 * Class ConfigJson (ConfigIO implementation)
@@ -21,7 +22,7 @@ class ConfigJson implements ConfigIO
21 $data = json_decode($data, true); 22 $data = json_decode($data, true);
22 if ($data === null) { 23 if ($data === null) {
23 $error = json_last_error(); 24 $error = json_last_error();
24 throw new Exception('An error occurred while parsing JSON file: error code #'. $error); 25 throw new \Exception('An error occurred while parsing JSON file: error code #'. $error);
25 } 26 }
26 return $data; 27 return $data;
27 } 28 }
@@ -35,7 +36,7 @@ class ConfigJson implements ConfigIO
35 $print = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0; 36 $print = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0;
36 $data = self::getPhpHeaders() . json_encode($conf, $print) . self::getPhpSuffix(); 37 $data = self::getPhpHeaders() . json_encode($conf, $print) . self::getPhpSuffix();
37 if (!file_put_contents($filepath, $data)) { 38 if (!file_put_contents($filepath, $data)) {
38 throw new IOException( 39 throw new \IOException(
39 $filepath, 40 $filepath,
40 'Shaarli could not create the config file. 41 'Shaarli could not create the config file.
41 Please make sure Shaarli has the right to write in the folder is it installed in.' 42 Please make sure Shaarli has the right to write in the folder is it installed in.'