aboutsummaryrefslogtreecommitdiff
path: root/app/Models/CategoryDAO.php
diff options
context:
space:
mode:
authorGravatar Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com> 2022-11-14 15:07:23 +0100
committerGravatar GitHub <noreply@github.com> 2022-11-14 15:07:23 +0100
commitd9e1c1c2c3abb6cf91b6866961d2a482ef50c3ea (patch)
tree5beb69c38870771d4c7239dc9a3dba7ca508fde0 /app/Models/CategoryDAO.php
parenta44e2a0d0c35c63a94abfc482955c23d9d823e4a (diff)
Typing function checkToken (#4561)
* Typing function checkToken * Typing function and rename Co-authored-by: Luc SANCHEZ <luc.sanchez@zol.fr>
Diffstat (limited to 'app/Models/CategoryDAO.php')
-rw-r--r--app/Models/CategoryDAO.php15
1 files changed, 7 insertions, 8 deletions
diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php
index 20a92d52a..c855f1495 100644
--- a/app/Models/CategoryDAO.php
+++ b/app/Models/CategoryDAO.php
@@ -265,7 +265,7 @@ SQL;
return $categories;
}
- uasort($categories, function ($a, $b) {
+ uasort($categories, static function ($a, $b) {
$aPosition = $a->attributes('position');
$bPosition = $b->attributes('position');
if ($aPosition === $bPosition) {
@@ -310,9 +310,9 @@ SQL;
}
/** @return array<FreshRSS_Category> */
- public function listCategoriesOrderUpdate(int $defaultCacheDuration = 86400, int $limit = 0) {
+ public function listCategoriesOrderUpdate(int $defaultCacheDuration = 86400, int $limit = 0): array {
$sql = 'SELECT * FROM `_category` WHERE kind = :kind AND `lastUpdate` < :lu ORDER BY `lastUpdate`'
- . ($limit < 1 ? '' : ' LIMIT ' . intval($limit));
+ . ($limit < 1 ? '' : ' LIMIT ' . $limit);
$stm = $this->pdo->prepare($sql);
if ($stm &&
$stm->bindValue(':kind', FreshRSS_Category::KIND_DYNAMIC_OPML, PDO::PARAM_INT) &&
@@ -387,7 +387,7 @@ SQL;
return $res[0]['count'];
}
- public function countFeed($id) {
+ public function countFeed(int $id) {
$sql = 'SELECT COUNT(*) AS count FROM `_feed` WHERE category=:id';
$stm = $this->pdo->prepare($sql);
$stm->bindParam(':id', $id, PDO::PARAM_INT);
@@ -396,7 +396,7 @@ SQL;
return $res[0]['count'];
}
- public function countNotRead($id) {
+ public function countNotRead(int $id) {
$sql = 'SELECT COUNT(*) AS count FROM `_entry` e INNER JOIN `_feed` f ON e.id_feed=f.id WHERE category=:id AND e.is_read=0';
$stm = $this->pdo->prepare($sql);
$stm->bindParam(':id', $id, PDO::PARAM_INT);
@@ -409,7 +409,7 @@ SQL;
* @param array<FreshRSS_Category> $categories
* @param int $feed_id
*/
- public static function findFeed($categories, $feed_id) {
+ public static function findFeed(array $categories, int $feed_id) {
foreach ($categories as $category) {
foreach ($category->feeds() as $feed) {
if ($feed->id() === $feed_id) {
@@ -422,9 +422,8 @@ SQL;
/**
* @param array<FreshRSS_Category> $categories
- * @param int $minPriority
*/
- public static function CountUnreads($categories, $minPriority = 0) {
+ public static function countUnread(array $categories, int $minPriority = 0): int {
$n = 0;
foreach ($categories as $category) {
foreach ($category->feeds() as $feed) {