namespacing: \Shaarli\FileUtils

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
This commit is contained in:
VirtualTam 2018-12-03 00:59:21 +01:00
parent 8c0f19c797
commit a0c4dbd91c
7 changed files with 12 additions and 11 deletions

View File

@ -1,8 +1,8 @@
<?php <?php
use Shaarli\Exceptions\IOException; namespace Shaarli;
require_once 'exceptions/IOException.php'; use Shaarli\Exceptions\IOException;
/** /**
* Class FileUtils * Class FileUtils
@ -46,7 +46,7 @@ class FileUtils
return file_put_contents( return file_put_contents(
$file, $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. // Note that gzinflate is faster than gzuncompress.
// See: http://www.php.net/manual/en/function.gzdeflate.php#96439 // See: http://www.php.net/manual/en/function.gzdeflate.php#96439
if (! is_readable($file)) { if (!is_readable($file)) {
return $default; return $default;
} }

View File

@ -3,7 +3,6 @@ namespace Shaarli;
use DateTime; use DateTime;
use Exception; use Exception;
use FileUtils;
/** /**
* Class History * Class History
@ -71,7 +70,7 @@ class History
* History constructor. * History constructor.
* *
* @param string $historyFilePath History file path. * @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. * @throws Exception if something goes wrong.
*/ */
@ -146,7 +145,7 @@ class History
* Save a new event and write it in the history file. * Save a new event and write it in the history file.
* *
* @param string $status Event key, should be defined as constant. * @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) protected function addEvent($status, $id = null)
{ {

View File

@ -1,6 +1,7 @@
<?php <?php
use Shaarli\Exceptions\IOException; use Shaarli\Exceptions\IOException;
use Shaarli\FileUtils;
/** /**
* Data storage for links. * Data storage for links.

View File

@ -16,6 +16,7 @@
}, },
"require": { "require": {
"php": ">=5.6", "php": ">=5.6",
"ext-zlib": "*",
"shaarli/netscape-bookmark-parser": "^2.1", "shaarli/netscape-bookmark-parser": "^2.1",
"erusev/parsedown": "^1.6", "erusev/parsedown": "^1.6",
"slim/slim": "^3.0", "slim/slim": "^3.0",

View File

@ -1,15 +1,15 @@
<?php <?php
use Shaarli\Exceptions\IOException; namespace Shaarli;
require_once 'application/FileUtils.php'; use Exception;
/** /**
* Class FileUtilsTest * Class FileUtilsTest
* *
* Test file utility class. * Test file utility class.
*/ */
class FileUtilsTest extends PHPUnit_Framework_TestCase class FileUtilsTest extends \PHPUnit\Framework\TestCase
{ {
/** /**
* @var string Test file path. * @var string Test file path.

View File

@ -4,7 +4,6 @@ namespace Shaarli;
use DateTime; use DateTime;
use Exception; use Exception;
use FileUtils;
class HistoryTest extends \PHPUnit\Framework\TestCase class HistoryTest extends \PHPUnit\Framework\TestCase
{ {

View File

@ -1,5 +1,6 @@
<?php <?php
use Shaarli\FileUtils;
use Shaarli\History; use Shaarli\History;
/** /**