Refacto all project #1

Merged
Xefir merged 18 commits from test into master 2023-06-17 23:48:37 +00:00
3 changed files with 6 additions and 7 deletions
Showing only changes of commit 23bcb0d159 - Show all commits

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
$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;
}
}

View File

@ -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);
}
}

View File

@ -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;