| Conditions | 3 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | public function run(RequestInterface $request, ResponseInterface $response) |
||
| 23 | { |
||
| 24 | $cache = $this->cachePool(); |
||
| 25 | $result = $cache->purge(); |
||
|
|
|||
| 26 | |||
| 27 | if ($result) { |
||
| 28 | $message = $this->translator()->translate('Cache purged successfully.'); |
||
| 29 | } else { |
||
| 30 | $message = $this->translator()->translate('Failed to purge cache.'); |
||
| 31 | } |
||
| 32 | |||
| 33 | $this->setSuccess($result); |
||
| 34 | |||
| 35 | if ($result) { |
||
| 36 | $this->addFeedback('success', $message); |
||
| 37 | return $response; |
||
| 38 | } else { |
||
| 39 | $this->addFeedback('error', $message); |
||
| 40 | return $response->withStatus(500); |
||
| 41 | } |
||
| 44 |