aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/config/ConfigJson.php
diff options
context:
space:
mode:
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.'