diff --git a/composer.json b/composer.json index 6002794..f0f7091 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "type": "project", "license": "AGPL-3.0-or-later", "require-dev": { - "nextcloud/ocp": "^21.0.0", + "nextcloud/ocp": "^27.0.0", "psalm/phar": "^5.12.0", "nextcloud/coding-standard": "^1.1.1" }, diff --git a/composer.lock b/composer.lock index a4a8f91..eaf77a9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6684feffdd51c1ea6c0f31066f3e5560", + "content-hash": "5c7be477b217d6074abc6c2f8d2c2256", "packages": [], "packages-dev": [ { @@ -50,25 +50,29 @@ }, { "name": "nextcloud/ocp", - "version": "v21.0.0", + "version": "v27.0.0", "source": { "type": "git", "url": "https://github.com/nextcloud-deps/ocp.git", - "reference": "41e1476b4aed5bce7371895054049eca353729c5" + "reference": "c374aa2d4c3491812c19a53ce14063127daea08e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/41e1476b4aed5bce7371895054049eca353729c5", - "reference": "41e1476b4aed5bce7371895054049eca353729c5", + "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/c374aa2d4c3491812c19a53ce14063127daea08e", + "reference": "c374aa2d4c3491812c19a53ce14063127daea08e", "shasum": "" }, "require": { - "php": "^7.3 || ~8.0.0" + "php": "^7.4 || ~8.0 || ~8.1", + "psr/clock": "^1.0", + "psr/container": "^2.0.2", + "psr/event-dispatcher": "^1.0", + "psr/log": "^1.1.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "21.0.0-dev" + "dev-stable27": "27.0.0-dev" } }, "notification-url": "https://packagist.org/downloads/", @@ -83,9 +87,10 @@ ], "description": "Composer package containing Nextcloud's public API (classes, interfaces)", "support": { - "source": "https://github.com/nextcloud-deps/ocp/tree/v21.0.0" + "issues": "https://github.com/nextcloud-deps/ocp/issues", + "source": "https://github.com/nextcloud-deps/ocp/tree/v27.0.0" }, - "time": "2021-03-01T08:42:25+00:00" + "time": "2023-06-16T07:25:09+00:00" }, { "name": "php-cs-fixer/shim", @@ -173,6 +178,207 @@ "source": "https://github.com/psalm/phar/tree/5.12.0" }, "time": "2023-05-22T21:30:41+00:00" + }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" + }, + "time": "2021-05-03T11:20:27+00:00" } ], "aliases": [], diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index b05b624..b9a8f1a 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -161,9 +161,12 @@ class PageController extends Controller { ->getId(); } + /** @var array $pathInfo */ + $pathInfo = pathInfo($filePath); + return [ - 'fileName' => pathInfo($filePath, PATHINFO_FILENAME), - 'fileType' => strtolower(pathInfo($filePath, PATHINFO_EXTENSION)), + 'fileName' => $pathInfo['filename'], + 'fileType' => strtolower($pathInfo['extension']), 'fileId' => $fileId ]; } diff --git a/lib/Db/Bookmark.php b/lib/Db/Bookmark.php index 2b75f78..20e3158 100644 --- a/lib/Db/Bookmark.php +++ b/lib/Db/Bookmark.php @@ -55,7 +55,7 @@ class Bookmark extends ReaderEntity implements \JsonSerializable { return $this->fileId; } - public function setFileId($fileId) { + public function setFileId(int $fileId) { $this->fileId = $fileId; } @@ -71,7 +71,7 @@ class Bookmark extends ReaderEntity implements \JsonSerializable { return $this->name; } - public function setName($name) { + public function setName(string $name) { $this->name = $name; } @@ -79,7 +79,7 @@ class Bookmark extends ReaderEntity implements \JsonSerializable { return $this->value; } - public function setValue($value) { + public function setValue(string $value) { $this->value = $value; } diff --git a/lib/Db/BookmarkMapper.php b/lib/Db/BookmarkMapper.php index 162b24e..2578cc9 100644 --- a/lib/Db/BookmarkMapper.php +++ b/lib/Db/BookmarkMapper.php @@ -11,7 +11,7 @@ namespace OCA\Epubreader\Db; use OCA\Epubreader\Utility\Time; - +use OCP\AppFramework\Db\Entity; use OCP\IDBConnection; class BookmarkMapper extends ReaderMapper { @@ -60,7 +60,7 @@ class BookmarkMapper extends ReaderMapper { * @param string $name * @param string $value * - * @return Bookmark the newly created or updated bookmark + * @return Entity the newly created or updated bookmark */ public function set($fileId, $name, $value, $type, $content = null) { diff --git a/lib/Db/Preference.php b/lib/Db/Preference.php index f1b0b12..b994a12 100644 --- a/lib/Db/Preference.php +++ b/lib/Db/Preference.php @@ -49,7 +49,7 @@ class Preference extends ReaderEntity implements \JsonSerializable { return $this->scope; } - public function setScope($scope) { + public function setScope(string $scope) { $this->scope = $scope; } @@ -57,7 +57,7 @@ class Preference extends ReaderEntity implements \JsonSerializable { return $this->fileId; } - public function setFileId($fileId) { + public function setFileId(int $fileId) { $this->fileId = $fileId; } @@ -65,7 +65,7 @@ class Preference extends ReaderEntity implements \JsonSerializable { return $this->name; } - public function setName($name) { + public function setName(string $name) { $this->name = $name; } @@ -73,7 +73,7 @@ class Preference extends ReaderEntity implements \JsonSerializable { return $this->value; } - public function setValue($value) { + public function setValue(string $value) { $this->value = $value; } diff --git a/lib/Db/PreferenceMapper.php b/lib/Db/PreferenceMapper.php index 354eff6..60485eb 100644 --- a/lib/Db/PreferenceMapper.php +++ b/lib/Db/PreferenceMapper.php @@ -11,6 +11,7 @@ namespace OCA\Epubreader\Db; use OCA\Epubreader\Utility\Time; +use OCP\AppFramework\Db\Entity; use OCP\IDBConnection; class PreferenceMapper extends ReaderMapper { @@ -53,7 +54,7 @@ class PreferenceMapper extends ReaderMapper { * @param string $name * @param string $value * - * @return Preference the newly created or updated preference + * @return Entity the newly created or updated preference */ public function set($scope, $fileId, $name, $value) { diff --git a/lib/Db/ReaderEntity.php b/lib/Db/ReaderEntity.php index 980161e..80723b4 100644 --- a/lib/Db/ReaderEntity.php +++ b/lib/Db/ReaderEntity.php @@ -30,7 +30,7 @@ class ReaderEntity extends Entity { return $this->lastModified; } - public function setLastModified($lastModified) { + public function setLastModified(string $lastModified) { $this->lastModified = $lastModified; } diff --git a/psalm.xml b/psalm.xml index ff021cc..f8ce4f9 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,6 +1,6 @@ + + +