Refacto all project #1

Merged
Xefir merged 18 commits from test into master 2023-06-17 23:48:37 +00:00
9 changed files with 237 additions and 24 deletions
Showing only changes of commit 2baaae1453 - Show all commits

View File

@ -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"
},

224
composer.lock generated
View File

@ -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": [],

View File

@ -161,9 +161,12 @@ class PageController extends Controller {
->getId();
}
/** @var array<string> $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
];
}

View File

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

View File

@ -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) {

View File

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

View File

@ -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) {

View File

@ -30,7 +30,7 @@ class ReaderEntity extends Entity {
return $this->lastModified;
}
public function setLastModified($lastModified) {
public function setLastModified(string $lastModified) {
$this->lastModified = $lastModified;
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<psalm
errorLevel="4"
errorLevel="2"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
@ -9,6 +9,9 @@
<projectFiles>
<directory name="lib" />
<directory name="stubs" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<extraFiles>
<directory name="vendor" />