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 | * Custom Page 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 2026 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 2026-01-12 |
| 16 | */ |
| 17 | |
| 18 | declare(strict_types=1); |
| 19 | |
| 20 | namespace phpMyFAQ\CustomPage; |
| 21 | |
| 22 | use phpMyFAQ\Entity\CustomPageEntity; |
| 23 | use stdClass; |
| 24 | |
| 25 | /** |
| 26 | * Contract for CustomPage repositories. |
| 27 | */ |
| 28 | interface CustomPageRepositoryInterface |
| 29 | { |
| 30 | /** |
| 31 | * @return iterable<stdClass> |
| 32 | */ |
| 33 | public function getAll(string $language, bool $activeOnly = false): iterable; |
| 34 | |
| 35 | /** |
| 36 | * @return iterable<stdClass> |
| 37 | */ |
| 38 | public function getAllPaginated( |
| 39 | string $language, |
| 40 | bool $activeOnly, |
| 41 | int $limit, |
| 42 | int $offset, |
| 43 | string $sortField, |
| 44 | string $sortOrder, |
| 45 | ): iterable; |
| 46 | |
| 47 | /** |
| 48 | * Get all pages across all languages with pagination |
| 49 | * @return iterable<stdClass> |
| 50 | */ |
| 51 | public function getAllLanguagesPaginated( |
| 52 | bool $activeOnly, |
| 53 | int $limit, |
| 54 | int $offset, |
| 55 | string $sortField, |
| 56 | string $sortOrder, |
| 57 | ): iterable; |
| 58 | |
| 59 | public function countAll(string $language, bool $activeOnly = false): int; |
| 60 | |
| 61 | public function countAllLanguages(bool $activeOnly = false): int; |
| 62 | |
| 63 | public function getById(int $pageId, string $language): ?stdClass; |
| 64 | |
| 65 | public function getBySlug(string $slug, string $language): ?stdClass; |
| 66 | |
| 67 | /** |
| 68 | * @return array<string> |
| 69 | */ |
| 70 | public function getExistingLanguages(int $pageId): array; |
| 71 | |
| 72 | public function insert(CustomPageEntity $page): int; |
| 73 | |
| 74 | public function insertTranslation(CustomPageEntity $page, int $pageId): bool; |
| 75 | |
| 76 | public function update(CustomPageEntity $page): bool; |
| 77 | |
| 78 | public function delete(int $pageId, string $language): bool; |
| 79 | |
| 80 | public function activate(int $pageId, bool $status): bool; |
| 81 | |
| 82 | public function slugExists(string $slug, string $language, ?int $excludeId = null): bool; |
| 83 | } |