| 1 |
<?php |
| 2 |
|
| 3 |
namespace Code_Snippets\Flat_Files\Interfaces; |
| 4 |
|
| 5 |
use Code_Snippets\Model\Snippet; |
| 6 |
|
| 7 |
/** |
| 8 |
* Interface for storing snippet configuration within a flat file. |
| 9 |
*/ |
| 10 |
interface Snippet_Config_Repository { |
| 11 |
|
| 12 |
/** |
| 13 |
* Load configuration from a directory. |
| 14 |
* |
| 15 |
* @param string $base_dir Full filesystem path to directory. |
| 16 |
* |
| 17 |
* @return array Loaded configuration. |
| 18 |
*/ |
| 19 |
public function load( string $base_dir ): array; |
| 20 |
|
| 21 |
/** |
| 22 |
* Store configuration. |
| 23 |
* |
| 24 |
* @param string $base_dir Full filesystem path to configuration directory. |
| 25 |
* @param array $active_snippets List of active snippets. |
| 26 |
* |
| 27 |
* @return void |
| 28 |
*/ |
| 29 |
public function save( string $base_dir, array $active_snippets ): void; |
| 30 |
|
| 31 |
/** |
| 32 |
* Update stored configuration for a snippet. |
| 33 |
* |
| 34 |
* @param string $base_dir Full filesystem path to configuration directory. |
| 35 |
* @param Snippet $snippet Snippet to update. |
| 36 |
* @param bool|null $remove Whether to remove the snippet from the configuration. |
| 37 |
* |
| 38 |
* @return void |
| 39 |
*/ |
| 40 |
public function update( string $base_dir, Snippet $snippet, ?bool $remove = false ): void; |
| 41 |
} |
| 42 |
|