]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
namespacing: \Shaarli\Exceptions\IOException
authorVirtualTam <virtualtam@flibidi.net>
Sun, 2 Dec 2018 22:31:40 +0000 (23:31 +0100)
committerVirtualTam <virtualtam@flibidi.net>
Sat, 12 Jan 2019 21:47:48 +0000 (22:47 +0100)
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
application/FileUtils.php
application/LinkDB.php
application/Updater.php
application/config/ConfigJson.php
application/config/ConfigManager.php
application/config/ConfigPhp.php
application/exceptions/IOException.php
composer.json
tests/FileUtilsTest.php
tests/LinkDBTest.php
tests/config/ConfigJsonTest.php

index b89ea12bcc26cb7e67b09eaa60f11abf9b0c552a..ba409821c03c0b235e0b9ea86151c6bbf30bc911 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Shaarli\Exceptions\IOException;
+
 require_once 'exceptions/IOException.php';
 
 /**
index 4bbc2950e223ab86817cd8fa63c74a866bc7db03..87a53e2e99563edf6749f52c763053599b40a399 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Shaarli\Exceptions\IOException;
+
 /**
  * Data storage for links.
  *
index 6b94c5e34af485e8327628206cb9c19aa6c6f7f7..c0d541b440eac363dae43a8682d82fe971600e0c 100644 (file)
@@ -2,6 +2,7 @@
 use Shaarli\Config\ConfigJson;
 use Shaarli\Config\ConfigPhp;
 use Shaarli\Config\ConfigManager;
+use Shaarli\Exceptions\IOException;
 use Shaarli\Thumbnailer;
 
 /**
index 8c8d5610efb145c49c3b319514f7e3ba0dab68ca..4509357ce887ea8a28334a68c50f999294780243 100644 (file)
@@ -47,7 +47,7 @@ class ConfigJson implements ConfigIO
         $print = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0;
         $data = self::getPhpHeaders() . json_encode($conf, $print) . self::getPhpSuffix();
         if (!file_put_contents($filepath, $data)) {
-            throw new \IOException(
+            throw new \Shaarli\Exceptions\IOException(
                 $filepath,
                 t('Shaarli could not create the config file. '.
                   'Please make sure Shaarli has the right to write in the folder is it installed in.')
index 32aaea48e870ab13af7714c5a53d84cf0356d613..e6c3507329dc7e39a162c6fc4ec1103da8fadff2 100644 (file)
@@ -207,7 +207,7 @@ class ConfigManager
      *
      * @throws MissingFieldConfigException: a mandatory field has not been provided in $conf.
      * @throws UnauthorizedConfigException: user is not authorize to change configuration.
-     * @throws \IOException: an error occurred while writing the new config file.
+     * @throws \Shaarli\Exceptions\IOException: an error occurred while writing the new config file.
      */
     public function write($isLoggedIn)
     {
index 9625fe1a98156397b0210b80cf95bce8dd3a7821..9ed5d31fec0ab36e09a490c77c52952c1eb74db8 100644 (file)
@@ -124,7 +124,7 @@ class ConfigPhp implements ConfigIO
         if (!file_put_contents($filepath, $configStr)
             || strcmp(file_get_contents($filepath), $configStr) != 0
         ) {
-            throw new \IOException(
+            throw new \Shaarli\Exceptions\IOException(
                 $filepath,
                 t('Shaarli could not create the config file. '.
                   'Please make sure Shaarli has the right to write in the folder is it installed in.')
index 18e46b77a2291999eb9b3ee8656de4c4cb17efe6..2aa25e5c55be709b4dfeb2c8c1451ef437597a40 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+namespace Shaarli\Exceptions;
+
+use Exception;
 
 /**
  * Exception class thrown when a filesystem access failure happens
@@ -17,6 +20,6 @@ class IOException extends Exception
     {
         $this->path = $path;
         $this->message = empty($message) ? t('Error accessing') : $message;
-        $this->message .= ' "' . $this->path .'"';
+        $this->message .= ' "' . $this->path . '"';
     }
 }
index dccf83b62b5862371b1447ea9d0fbc571721337b..027203f48304ceb197b1342d736e4572301d9ab1 100644 (file)
@@ -36,6 +36,7 @@
             "Shaarli\\Api\\Exceptions\\": "application/api/exceptions",
             "Shaarli\\Config\\": "application/config/",
             "Shaarli\\Config\\Exception\\": "application/config/exception",
+            "Shaarli\\Exceptions\\": "application/exceptions",
             "Shaarli\\Security\\": "application/security"
         }
     }
index d764e4953a1bff4870eaca13683e09864c736e42..9596dba9d8c8e3ed1faf120a99e03cf476d1f3da 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Shaarli\Exceptions\IOException;
+
 require_once 'application/FileUtils.php';
 
 /**
@@ -48,7 +50,7 @@ class FileUtilsTest extends PHPUnit_Framework_TestCase
     /**
      * File not writable: raise an exception.
      *
-     * @expectedException IOException
+     * @expectedException Shaarli\Exceptions\IOException
      * @expectedExceptionMessage Error accessing "sandbox/flat.db"
      */
     public function testWriteWithoutPermission()
@@ -61,7 +63,7 @@ class FileUtilsTest extends PHPUnit_Framework_TestCase
     /**
      * Folder non existent: raise an exception.
      *
-     * @expectedException IOException
+     * @expectedException Shaarli\Exceptions\IOException
      * @expectedExceptionMessage Error accessing "nopefolder"
      */
     public function testWriteFolderDoesNotExist()
@@ -72,7 +74,7 @@ class FileUtilsTest extends PHPUnit_Framework_TestCase
     /**
      * Folder non writable: raise an exception.
      *
-     * @expectedException IOException
+     * @expectedException Shaarli\Exceptions\IOException
      * @expectedExceptionMessage Error accessing "sandbox"
      */
     public function testWriteFolderPermission()
index c763c0cbd5f34ce7797658b7bcae2e72829f3290..9b2f35e6a678ff6fc97a1d2a2f0157864f6ad096 100644 (file)
@@ -3,6 +3,8 @@
  * Link datastore tests
  */
 
+use Shaarli\Exceptions\IOException;
+
 require_once 'application/Cache.php';
 require_once 'application/FileUtils.php';
 require_once 'application/LinkDB.php';
@@ -100,7 +102,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase
     /**
      * Attempt to instantiate a LinkDB whereas the datastore is not writable
      *
-     * @expectedException              IOException
+     * @expectedException              Shaarli\Exceptions\IOException
      * @expectedExceptionMessageRegExp /Error accessing "null"/
      */
     public function testConstructDatastoreNotWriteable()
index d237bc80cdacd1a7919399f68cad57ece869a470..99c1ea569c00deb9b6c8bb49898b03517171623d 100644 (file)
@@ -111,7 +111,7 @@ class ConfigJsonTest extends \PHPUnit_Framework_TestCase
     /**
      * Write to invalid path.
      *
-     * @expectedException \IOException
+     * @expectedException \Shaarli\Exceptions\IOException
      */
     public function testWriteInvalidArray()
     {
@@ -122,7 +122,7 @@ class ConfigJsonTest extends \PHPUnit_Framework_TestCase
     /**
      * Write to invalid path.
      *
-     * @expectedException \IOException
+     * @expectedException \Shaarli\Exceptions\IOException
      */
     public function testWriteInvalidBlank()
     {