<?php
+declare(strict_types=1);
+
namespace Shaarli\Bookmark;
use malkusch\lock\mutex\Mutex;
/**
* Reads database from disk to memory
*
- * @return BookmarkArray instance
+ * @return Bookmark[]
*
* @throws NotWritableDataStoreException Data couldn't be loaded
* @throws EmptyDataStoreException Datastore file exists but does not contain any bookmark
/**
* Saves the database from memory to disk
*
- * @param BookmarkArray $links instance.
+ * @param Bookmark[] $links
*
* @throws NotWritableDataStoreException the datastore is not writable
*/
if (is_file($this->datastore) && !is_writeable($this->datastore)) {
// The datastore exists but is not writeable
throw new NotWritableDataStoreException($this->datastore);
- } else if (!is_file($this->datastore) && !is_writeable(dirname($this->datastore))) {
+ } elseif (!is_file($this->datastore) && !is_writeable(dirname($this->datastore))) {
// The datastore does not exist and its parent directory is not writeable
throw new NotWritableDataStoreException(dirname($this->datastore));
}
- $data = self::$phpPrefix.base64_encode(gzdeflate(serialize($links))).self::$phpSuffix;
+ $data = self::$phpPrefix . base64_encode(gzdeflate(serialize($links))) . self::$phpSuffix;
$this->mutex->synchronized(function () use ($data) {
file_put_contents(