| 1 | <?php |
||
| 7 | class FilterConfiguration |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var array |
||
| 11 | */ |
||
| 12 | protected $filters = array(); |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @param array $filters |
||
| 16 | */ |
||
| 17 | public function __construct(array $filters = array()) |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Gets a previously configured filter. |
||
| 24 | * |
||
| 25 | * @param string $filter |
||
| 26 | * |
||
| 27 | * @return array |
||
| 28 | * |
||
| 29 | * @throws NonExistingFilterException |
||
| 30 | */ |
||
| 31 | public function get($filter) |
||
| 32 | { |
||
| 33 | if (false === array_key_exists($filter, $this->filters)) { |
||
| 34 | throw new NonExistingFilterException(sprintf('Could not find configuration for a filter: %s', $filter)); |
||
| 35 | } |
||
| 36 | |||
| 37 | return $this->filters[$filter]; |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Sets a configuration on the given filter. |
||
| 42 | * |
||
| 43 | * @param string $filter |
||
| 44 | * @param array $config |
||
| 45 | * |
||
| 46 | * @return array |
||
| 47 | */ |
||
| 48 | public function set($filter, array $config) |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Get all filters. |
||
| 55 | * |
||
| 56 | * @return array |
||
| 57 | */ |
||
| 58 | public function all() |
||
| 62 | } |
||
| 63 |