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