Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Visits repository interface |
| 5 | * |
| 6 | * This Source Code Form is subject to the terms of the Mozilla Public License, |
| 7 | * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
| 8 | * obtain one at https://mozilla.org/MPL/2.0/. |
| 9 | * |
| 10 | * @package phpMyFAQ |
| 11 | * @author Thorsten Rinne <thorsten@phpmyfaq.de> |
| 12 | * @copyright 2025 phpMyFAQ Team |
| 13 | * @license https://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
| 14 | * @link https://www.phpmyfaq.de |
| 15 | * @since 2025-11-23 |
| 16 | */ |
| 17 | |
| 18 | declare(strict_types=1); |
| 19 | |
| 20 | namespace phpMyFAQ\Visits; |
| 21 | |
| 22 | /** |
| 23 | * Contract for Visits repositories. |
| 24 | */ |
| 25 | interface VisitsRepositoryInterface |
| 26 | { |
| 27 | /** |
| 28 | * Get the visit count for a FAQ record. |
| 29 | */ |
| 30 | public function getVisitCount(int $faqId, string $language): int; |
| 31 | |
| 32 | /** |
| 33 | * Check if a visit record exists for a FAQ record. |
| 34 | */ |
| 35 | public function exists(int $faqId, string $language): bool; |
| 36 | |
| 37 | /** |
| 38 | * Insert a new visit record. |
| 39 | */ |
| 40 | public function insert(int $faqId, string $language, int $timestamp): bool; |
| 41 | |
| 42 | /** |
| 43 | * Update an existing visit record. |
| 44 | */ |
| 45 | public function update(int $faqId, string $language, int $timestamp): bool; |
| 46 | |
| 47 | /** |
| 48 | * Get all visit data ordered by visits DESC. |
| 49 | * |
| 50 | * @return array<int, array<string, mixed>> |
| 51 | */ |
| 52 | public function getAll(): array; |
| 53 | |
| 54 | /** |
| 55 | * Reset all visits to 1 and update last_visit to the current timestamp. |
| 56 | */ |
| 57 | public function resetAll(int $timestamp): bool; |
| 58 | } |