From b23b7706340f392ce0d16862325851fdab10918c Mon Sep 17 00:00:00 2001 From: mrilyew <99399973+mrilyew@users.noreply.github.com> Date: Sun, 2 Mar 2025 20:20:51 +0300 Subject: [PATCH] linter --- Web/Models/Repositories/Faves.php | 12 ++++++++---- Web/Presenters/UserPresenter.php | 24 ++++++++++++------------ 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Web/Models/Repositories/Faves.php b/Web/Models/Repositories/Faves.php index 6fb3f987..dbe139ff 100644 --- a/Web/Models/Repositories/Faves.php +++ b/Web/Models/Repositories/Faves.php @@ -1,5 +1,9 @@ -context = DatabaseConnection::i()->getContext(); $this->likes = $this->context->table("likes"); @@ -25,7 +29,7 @@ class Faves return $fetch; } - function fetchLikesSection(User $user, string $class = 'Post', int $page = 1, ?int $perPage = NULL): \Traversable + public function fetchLikesSection(User $user, string $class = 'Post', int $page = 1, ?int $perPage = NULL): \Traversable { $perPage ??= OPENVK_DEFAULT_PER_PAGE; $fetch = $this->fetchLikes($user, $class)->page($page, $perPage)->order("index DESC"); @@ -41,7 +45,7 @@ class Faves } } - function fetchLikesSectionCount(User $user, string $class = 'Post') + public function fetchLikesSectionCount(User $user, string $class = 'Post') { return $this->fetchLikes($user, $class)->count(); } diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php index 07d702cd..7d152df4 100644 --- a/Web/Presenters/UserPresenter.php +++ b/Web/Presenters/UserPresenter.php @@ -945,43 +945,43 @@ final class UserPresenter extends OpenVKPresenter } } - function renderFave(): void + public function renderFave(): void { $this->assertUserLoggedIn(); - $page = (int)($this->queryParam("p") ?? 1); + $page = (int) ($this->queryParam("p") ?? 1); $section = $this->queryParam("section") ?? "posts"; $display_section = "posts"; - $data = NULL; + $data = null; $count = 0; - switch($section) { + switch ($section) { default: $this->notFound(); break; case 'wall': case 'post': case 'posts': - $data = (new Faves)->fetchLikesSection($this->user->identity, 'Post', $page); - $count = (new Faves)->fetchLikesSectionCount($this->user->identity, 'Post'); + $data = (new Faves())->fetchLikesSection($this->user->identity, 'Post', $page); + $count = (new Faves())->fetchLikesSectionCount($this->user->identity, 'Post'); $display_section = "posts"; break; case 'comment': case 'comments': - $data = (new Faves)->fetchLikesSection($this->user->identity, 'Comment', $page); - $count = (new Faves)->fetchLikesSectionCount($this->user->identity, 'Comment'); + $data = (new Faves())->fetchLikesSection($this->user->identity, 'Comment', $page); + $count = (new Faves())->fetchLikesSectionCount($this->user->identity, 'Comment'); $display_section = "comments"; break; case 'photo': case 'photos': - $data = (new Faves)->fetchLikesSection($this->user->identity, 'Photo', $page); - $count = (new Faves)->fetchLikesSectionCount($this->user->identity, 'Photo'); + $data = (new Faves())->fetchLikesSection($this->user->identity, 'Photo', $page); + $count = (new Faves())->fetchLikesSectionCount($this->user->identity, 'Photo'); $display_section = "photos"; break; case 'video': case 'videos': - $data = (new Faves)->fetchLikesSection($this->user->identity, 'Video', $page); - $count = (new Faves)->fetchLikesSectionCount($this->user->identity, 'Video'); + $data = (new Faves())->fetchLikesSection($this->user->identity, 'Video', $page); + $count = (new Faves())->fetchLikesSectionCount($this->user->identity, 'Video'); $display_section = "videos"; break; }