]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
namespacing: \Shaarli\FileUtils
authorVirtualTam <virtualtam@flibidi.net>
Sun, 2 Dec 2018 23:59:21 +0000 (00:59 +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/History.php
application/LinkDB.php
composer.json
tests/FileUtilsTest.php
tests/HistoryTest.php
tests/utils/ReferenceHistory.php

index ba409821c03c0b235e0b9ea86151c6bbf30bc911..30560bfc3a929a272a7932c893a7212f5d598da1 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 
-use Shaarli\Exceptions\IOException;
+namespace Shaarli;
 
-require_once 'exceptions/IOException.php';
+use Shaarli\Exceptions\IOException;
 
 /**
  * Class FileUtils
@@ -46,7 +46,7 @@ class FileUtils
 
         return file_put_contents(
             $file,
-            self::$phpPrefix.base64_encode(gzdeflate(serialize($content))).self::$phpSuffix
+            self::$phpPrefix . base64_encode(gzdeflate(serialize($content))) . self::$phpSuffix
         );
     }
 
@@ -64,7 +64,7 @@ class FileUtils
     {
         // Note that gzinflate is faster than gzuncompress.
         // See: http://www.php.net/manual/en/function.gzdeflate.php#96439
-        if (! is_readable($file)) {
+        if (!is_readable($file)) {
             return $default;
         }
 
index 8074a0172c634912adf507bcd2236d8419cffe81..a58466528050e2efb4aee4dbccb59f3629e42041 100644 (file)
@@ -3,7 +3,6 @@ namespace Shaarli;
 
 use DateTime;
 use Exception;
-use FileUtils;
 
 /**
  * Class History
@@ -71,7 +70,7 @@ class History
      * History constructor.
      *
      * @param string $historyFilePath History file path.
-     * @param int    $retentionTime   History content rentention time in seconds.
+     * @param int    $retentionTime   History content retention time in seconds.
      *
      * @throws Exception if something goes wrong.
      */
@@ -146,7 +145,7 @@ class History
      * Save a new event and write it in the history file.
      *
      * @param string $status Event key, should be defined as constant.
-     * @param mixed $id Event item identifier (e.g. link ID).
+     * @param mixed  $id     Event item identifier (e.g. link ID).
      */
     protected function addEvent($status, $id = null)
     {
index 87a53e2e99563edf6749f52c763053599b40a399..a5b42727e8fbb8d9f0076d23708d7595fc8f574a 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 use Shaarli\Exceptions\IOException;
+use Shaarli\FileUtils;
 
 /**
  * Data storage for links.
index 28b0adb510f183504fdc3ae3a65ecaa7dccac9cc..422a3a4ed6e701077f76a065ab9784d7e1b520e0 100644 (file)
@@ -16,6 +16,7 @@
     },
     "require": {
         "php": ">=5.6",
+        "ext-zlib": "*",
         "shaarli/netscape-bookmark-parser": "^2.1",
         "erusev/parsedown": "^1.6",
         "slim/slim": "^3.0",
index 9596dba9d8c8e3ed1faf120a99e03cf476d1f3da..57719175542c3562af141c0658a9b28e1ba96dcb 100644 (file)
@@ -1,15 +1,15 @@
 <?php
 
-use Shaarli\Exceptions\IOException;
+namespace Shaarli;
 
-require_once 'application/FileUtils.php';
+use Exception;
 
 /**
  * Class FileUtilsTest
  *
  * Test file utility class.
  */
-class FileUtilsTest extends PHPUnit_Framework_TestCase
+class FileUtilsTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * @var string Test file path.
index 7723c4617767be50e21af98779fa14a34cac9291..8303e53a40b512386559aa2e665aeb88c28cbfa2 100644 (file)
@@ -4,7 +4,6 @@ namespace Shaarli;
 
 use DateTime;
 use Exception;
-use FileUtils;
 
 class HistoryTest extends \PHPUnit\Framework\TestCase
 {
index f19cdf2fbd9abd94cdca7628ada7a42ae20a8529..e411c417e7e6ed96ccaf24becd51541dab347f52 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 
+use Shaarli\FileUtils;
 use Shaarli\History;
 
 /**