| Total Complexity | 5 |
| Total Lines | 57 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 8 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | class Filter extends CoreFilter |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @inheritDoc |
||
| 18 | */ |
||
| 19 | protected $block_filter = true; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @inheritDoc |
||
| 23 | */ |
||
| 24 | 1 | public function generateCacheKey(Request $request) |
|
| 25 | { |
||
| 26 | // Append the rules with the version of the browser to allow new rules to bust the cache |
||
| 27 | 1 | return md5(json_encode($this->config->get($this->config_path . 'rules', []))) . |
|
| 28 | 1 | ':' . |
|
| 29 | 1 | parent::generateCacheKey($request); |
|
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @inheritDoc |
||
| 34 | */ |
||
| 35 | 4 | public function parseFilterString($filter_string) |
|
| 36 | { |
||
| 37 | // NOTE: $filter_string is unused, but needed to match signature of the method. |
||
| 38 | |||
| 39 | 4 | $this->setFilterType($this->config->get($this->config_path . 'type')); |
|
| 40 | |||
| 41 | 3 | $this->rules = $this->config->get($this->config_path . 'rules', []); |
|
| 42 | 3 | } |
|
| 43 | |||
| 44 | /** |
||
| 45 | * Set the filter type. |
||
| 46 | * |
||
| 47 | * @param string $type |
||
| 48 | * |
||
| 49 | * @return void |
||
| 50 | * |
||
| 51 | * @throws InvalidFilterTypeException |
||
| 52 | */ |
||
| 53 | 4 | protected function setFilterType(string $type) |
|
| 71 | ) |
||
| 72 | ); |
||
| 73 | } |
||
| 75 |