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 | namespace App\Http\Repositories\interfaces; |
| 4 | |
| 5 | use App\Http\Models\RemoteConfig; |
| 6 | use App\Http\Models\RemoteConfigHistory; |
| 7 | use Illuminate\Contracts\Pagination\LengthAwarePaginator; |
| 8 | |
| 9 | /** |
| 10 | * Interface for remote config data access operations. |
| 11 | * |
| 12 | * Abstracts database queries for the single-row RemoteConfig model |
| 13 | * and its associated history/audit trail. |
| 14 | */ |
| 15 | interface IRemoteConfigRepository |
| 16 | { |
| 17 | /** |
| 18 | * Get the current active remote config. |
| 19 | * |
| 20 | * @return RemoteConfig|null The current config or null if none exists |
| 21 | */ |
| 22 | public function getCurrent(): ?RemoteConfig; |
| 23 | |
| 24 | /** |
| 25 | * Create or update the single-row remote config. |
| 26 | * |
| 27 | * @param array<string, mixed> $data The config data to upsert |
| 28 | * @return RemoteConfig The created or updated config |
| 29 | */ |
| 30 | public function upsert(array $data): RemoteConfig; |
| 31 | |
| 32 | /** |
| 33 | * Get paginated history entries, newest first. |
| 34 | * |
| 35 | * @param int $perPage Number of items per page |
| 36 | * @return LengthAwarePaginator<RemoteConfigHistory> |
| 37 | */ |
| 38 | public function getHistory(int $perPage = 20): LengthAwarePaginator; |
| 39 | |
| 40 | /** |
| 41 | * Find a history entry by its version string. |
| 42 | * |
| 43 | * @param string $version The version identifier |
| 44 | * @return RemoteConfigHistory|null The history entry or null |
| 45 | */ |
| 46 | public function getHistoryByVersion(string $version): ?RemoteConfigHistory; |
| 47 | |
| 48 | /** |
| 49 | * Create a new history entry. |
| 50 | * |
| 51 | * @param array<string, mixed> $snapshot The full config snapshot |
| 52 | * @param string $changedBy Who made the change |
| 53 | * @param string|null $description Description of the change |
| 54 | * @return RemoteConfigHistory The created history entry |
| 55 | */ |
| 56 | public function createHistoryEntry(array $snapshot, string $changedBy, ?string $description): RemoteConfigHistory; |
| 57 | } |