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 * News 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-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     2025-11-09
16 */
17
18declare(strict_types=1);
19
20namespace phpMyFAQ\News;
21
22use phpMyFAQ\Entity\NewsMessage;
23use stdClass;
24
25/**
26 * Contract for News repositories.
27 */
28interface NewsRepositoryInterface
29{
30    /**
31     * @return iterable<stdClass>
32     */
33    public function getLatest(string $language, bool $active = true, ?int $limit = null): iterable;
34
35    /**
36     * @return iterable<stdClass>
37     */
38    public function getLatestPaginated(
39        string $language,
40        bool $active = true,
41        int $limit = 25,
42        int $offset = 0,
43        string $sortField = 'datum',
44        string $sortOrder = 'DESC',
45    ): iterable;
46
47    public function countLatest(string $language, bool $active = true): int;
48
49    /**
50     * @return iterable<stdClass>
51     */
52    public function getHeaders(string $language): iterable;
53
54    public function getById(int $newsId, string $language): ?stdClass;
55
56    public function insert(NewsMessage $newsMessage): bool;
57
58    public function update(NewsMessage $newsMessage): bool;
59
60    public function delete(int $newsId, string $language): bool;
61
62    public function activate(int $newsId, bool $status): bool;
63}