| 1 |
<?php |
| 2 |
|
| 3 |
namespace AATXT\App\Infrastructure\Repositories; |
| 4 |
|
| 5 |
/** |
| 6 |
* Config Repository Interface |
| 7 |
* |
| 8 |
* Defines the contract for configuration storage and retrieval. |
| 9 |
* This interface abstracts WordPress options API for better testability |
| 10 |
* and adherence to Dependency Inversion Principle. |
| 11 |
*/ |
| 12 |
interface ConfigRepositoryInterface |
| 13 |
{ |
| 14 |
/** |
| 15 |
* Get a configuration value |
| 16 |
* |
| 17 |
* @param string $key The configuration key |
| 18 |
* @param mixed $default Default value if key doesn't exist |
| 19 |
* @return mixed The configuration value or default |
| 20 |
*/ |
| 21 |
public function get(string $key, $default = null); |
| 22 |
|
| 23 |
/** |
| 24 |
* Set a configuration value |
| 25 |
* |
| 26 |
* @param string $key The configuration key |
| 27 |
* @param mixed $value The value to store |
| 28 |
* @return bool True on success, false on failure |
| 29 |
*/ |
| 30 |
public function set(string $key, $value): bool; |
| 31 |
|
| 32 |
/** |
| 33 |
* Delete a configuration value |
| 34 |
* |
| 35 |
* @param string $key The configuration key to delete |
| 36 |
* @return bool True on success, false on failure |
| 37 |
*/ |
| 38 |
public function delete(string $key): bool; |
| 39 |
|
| 40 |
/** |
| 41 |
* Check if a configuration key exists |
| 42 |
* |
| 43 |
* @param string $key The configuration key to check |
| 44 |
* @return bool True if key exists, false otherwise |
| 45 |
*/ |
| 46 |
public function has(string $key): bool; |
| 47 |
} |
| 48 |
|