| 1 | <?php |
||
| 20 | abstract class HttpCacheSlot extends Slot |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * @var \eZ\Publish\Core\MVC\Symfony\Cache\GatewayCachePurger |
||
| 24 | */ |
||
| 25 | protected $httpCacheClearer; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @param \eZ\Publish\Core\MVC\Symfony\Cache\GatewayCachePurger $httpCacheClearer |
||
| 29 | */ |
||
| 30 | public function __construct(GatewayCachePurger $httpCacheClearer) |
||
| 31 | { |
||
| 32 | $this->httpCacheClearer = $httpCacheClearer; |
||
| 33 | } |
||
| 34 | |||
| 35 | public function receive(Signal $signal) |
||
| 36 | { |
||
| 37 | if (!$this->supports($signal)) { |
||
| 38 | return; |
||
| 39 | } |
||
| 40 | |||
| 41 | $this->purgeHttpCache($signal); |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Checks if $signal is supported by this handler. |
||
| 46 | * |
||
| 47 | * @param \eZ\Publish\Core\SignalSlot\Signal $signal |
||
| 48 | * |
||
| 49 | * @return bool |
||
| 50 | */ |
||
| 51 | abstract protected function supports(Signal $signal); |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Purges the HTTP cache for $signal. |
||
| 55 | * |
||
| 56 | * @param \eZ\Publish\Core\SignalSlot\Signal $signal |
||
| 57 | * |
||
| 58 | * @return mixed |
||
| 59 | */ |
||
| 60 | abstract protected function purgeHttpCache(Signal $signal); |
||
| 61 | } |
||
| 62 |