<?php
-use Shaarli\Exceptions\IOException;
+namespace Shaarli;
-require_once 'exceptions/IOException.php';
+use Shaarli\Exceptions\IOException;
/**
* 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
);
}
{
// 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;
}
use DateTime;
use Exception;
-use FileUtils;
/**
* 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.
*/
* 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)
{
<?php
use Shaarli\Exceptions\IOException;
+use Shaarli\FileUtils;
/**
* Data storage for links.
},
"require": {
"php": ">=5.6",
+ "ext-zlib": "*",
"shaarli/netscape-bookmark-parser": "^2.1",
"erusev/parsedown": "^1.6",
"slim/slim": "^3.0",
<?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.
use DateTime;
use Exception;
-use FileUtils;
class HistoryTest extends \PHPUnit\Framework\TestCase
{
<?php
+use Shaarli\FileUtils;
use Shaarli\History;
/**