Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** @license For full copyright and license information, please see the LICENSE.md file. */ |
| 6 | |
| 7 | namespace App\Modules\Dav\Domain\Repository; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | use App\Modules\Dav\Domain\Model\DavDevice; |
| 12 | |
| 13 | /** |
| 14 | * DAV Device Repository Contract Interface. |
| 15 | * |
| 16 | * Defines persistence and query operations for mobile and desktop DAV synchronization devices. |
| 17 | * |
| 18 | * @package App\Modules\Dav\Domain\Repository |
| 19 | */ |
| 20 | interface DavDeviceRepositoryInterface |
| 21 | { |
| 22 | /** |
| 23 | * Lists all active DAV devices for a user. |
| 24 | * |
| 25 | * @param int $userId Owner user ID. |
| 26 | * @return array<int, DavDevice> Collection of enrolled devices. |
| 27 | */ |
| 28 | public function listByUser(int $userId): array; |
| 29 | |
| 30 | /** |
| 31 | * Enrolls and persists a new DAV synchronization device. |
| 32 | * |
| 33 | * @param int $userId Owner user ID. |
| 34 | * @param string $deviceName Human-readable device label. |
| 35 | * @param string $deviceType Device platform category ('ios', 'android', 'macos', 'other'). |
| 36 | * @return DavDevice Newly enrolled device model. |
| 37 | */ |
| 38 | public function create(int $userId, string $deviceName, string $deviceType): DavDevice; |
| 39 | |
| 40 | /** |
| 41 | * Revokes and removes an enrolled synchronization device. |
| 42 | * |
| 43 | * @param int $deviceId Device primary ID. |
| 44 | * @param int $userId Owner user ID (for authorization check). |
| 45 | * @return bool True if device was removed. |
| 46 | */ |
| 47 | public function delete(int $deviceId, int $userId): bool; |
| 48 | |
| 49 | /** |
| 50 | * Finds an active device by its secret pairing sync token. |
| 51 | * |
| 52 | * @param string $token Unique sync token string. |
| 53 | * @return DavDevice|null Device instance if valid and active, null otherwise. |
| 54 | */ |
| 55 | public function findByToken(string $token): ?DavDevice; |
| 56 | |
| 57 | /** |
| 58 | * Updates the last synchronization timestamp for a device. |
| 59 | * |
| 60 | * @param int $deviceId Device ID. |
| 61 | * @return bool True on success. |
| 62 | */ |
| 63 | public function touchSync(int $deviceId): bool; |
| 64 | } |