From 23bcb0d15934d0f080960183724cb4d7928ab523 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sun, 18 Jun 2023 01:41:18 +0200 Subject: [PATCH] last fixes it seems --- lib/Hooks.php | 3 +-- lib/Service/BookmarkService.php | 8 ++++---- lib/Service/PreferenceService.php | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/Hooks.php b/lib/Hooks.php index 4000c3f..7c9411c 100644 --- a/lib/Hooks.php +++ b/lib/Hooks.php @@ -47,7 +47,6 @@ class Hooks { // TODO: remove this when Owncloud starts encoding oc_appconfig as JSON just like it already encodes most other properties $user = Server::get(IUserSession::class)->getUser(); if ($user && - array_key_exists('array', $settings) && is_array($settings['array']) && array_key_exists('oc_appconfig', $settings['array']) ) { @@ -84,6 +83,6 @@ class Hooks { } private static function isJson(mixed $string): bool { - return is_string($string) && is_array(json_decode($string, true)) && (json_last_error() == JSON_ERROR_NONE) ? true : false; + return is_string($string) && is_array(json_decode($string, true)) && json_last_error() == JSON_ERROR_NONE; } } diff --git a/lib/Service/BookmarkService.php b/lib/Service/BookmarkService.php index 45d483d..860e8eb 100644 --- a/lib/Service/BookmarkService.php +++ b/lib/Service/BookmarkService.php @@ -19,8 +19,8 @@ use OCA\Epubreader\Db\ReaderEntity; class BookmarkService extends Service { // "bookmark" name to use for the cursor (current reading position) - public const CURSOR = '__CURSOR__'; - public const bookmark_type = 'bookmark'; + private const CURSOR = '__CURSOR__'; + private const BOOKMARK_TYPE = 'bookmark'; private BookmarkMapper $bookmarkMapper; @@ -85,7 +85,7 @@ class BookmarkService extends Service { * @param string $value */ public function setCursor(int $fileId, string $value): ReaderEntity { - return $this->bookmarkMapper->set($fileId, self::CURSOR, $value, self::bookmark_type); + return $this->bookmarkMapper->set($fileId, self::CURSOR, $value, self::BOOKMARK_TYPE); } /** @@ -107,6 +107,6 @@ class BookmarkService extends Service { * @param int $fileId */ public function deleteCursor(int $fileId): void { - $this->delete($fileId, self::CURSOR, self::bookmark_type); + $this->delete($fileId, self::CURSOR, self::BOOKMARK_TYPE); } } diff --git a/lib/Service/PreferenceService.php b/lib/Service/PreferenceService.php index adbc03b..7ceb5e8 100644 --- a/lib/Service/PreferenceService.php +++ b/lib/Service/PreferenceService.php @@ -20,7 +20,7 @@ class PreferenceService extends Service { // (ab)use the fact that $fileId never goes below 1 by using the // value 0 to indicate a default preference - public const DEFAULTS = 0; + private const DEFAULTS = 0; private PreferenceMapper $preferenceMapper;