| Conditions | 5 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | public function purge($tags) |
||
| 39 | { |
||
| 40 | if (empty($tags)) { |
||
| 41 | return; |
||
| 42 | } |
||
| 43 | |||
| 44 | // As xkey only support one tag (key) being invalidated at a time, we loop. |
||
| 45 | // These will be queued by FOS\HttpCache\ProxyClient\Varnish and handled on kernel.terminate. |
||
| 46 | foreach (array_unique((array)$tags) as $tag) { |
||
| 47 | if (is_numeric($tag)) { |
||
| 48 | $tag = 'location-' . $tag; |
||
| 49 | } |
||
| 50 | |||
| 51 | $this->cacheManager->invalidatePath( |
||
| 52 | '/', |
||
| 53 | ['xkey' => $tag, 'Host' => empty($_SERVER['SERVER_NAME']) ? 'localhost' : $_SERVER['SERVER_NAME']] |
||
| 54 | ); |
||
| 55 | } |
||
| 56 | } |
||
| 57 | |||
| 63 |