last fixes it seems

This commit is contained in:
Michel Roux 2023-06-18 01:41:18 +02:00
parent 474a4dcf53
commit 23bcb0d159
3 changed files with 6 additions and 7 deletions

View File

@ -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 // 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(); $user = Server::get(IUserSession::class)->getUser();
if ($user && if ($user &&
array_key_exists('array', $settings) &&
is_array($settings['array']) && is_array($settings['array']) &&
array_key_exists('oc_appconfig', $settings['array']) array_key_exists('oc_appconfig', $settings['array'])
) { ) {
@ -84,6 +83,6 @@ class Hooks {
} }
private static function isJson(mixed $string): bool { 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;
} }
} }

View File

@ -19,8 +19,8 @@ use OCA\Epubreader\Db\ReaderEntity;
class BookmarkService extends Service { class BookmarkService extends Service {
// "bookmark" name to use for the cursor (current reading position) // "bookmark" name to use for the cursor (current reading position)
public const CURSOR = '__CURSOR__'; private const CURSOR = '__CURSOR__';
public const bookmark_type = 'bookmark'; private const BOOKMARK_TYPE = 'bookmark';
private BookmarkMapper $bookmarkMapper; private BookmarkMapper $bookmarkMapper;
@ -85,7 +85,7 @@ class BookmarkService extends Service {
* @param string $value * @param string $value
*/ */
public function setCursor(int $fileId, string $value): ReaderEntity { 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 * @param int $fileId
*/ */
public function deleteCursor(int $fileId): void { public function deleteCursor(int $fileId): void {
$this->delete($fileId, self::CURSOR, self::bookmark_type); $this->delete($fileId, self::CURSOR, self::BOOKMARK_TYPE);
} }
} }

View File

@ -20,7 +20,7 @@ class PreferenceService extends Service {
// (ab)use the fact that $fileId never goes below 1 by using the // (ab)use the fact that $fileId never goes below 1 by using the
// value 0 to indicate a default preference // value 0 to indicate a default preference
public const DEFAULTS = 0; private const DEFAULTS = 0;
private PreferenceMapper $preferenceMapper; private PreferenceMapper $preferenceMapper;