Completed
Push — EZP-31644 ( 2e0a1e...93bb44 )
by
unknown
19:12
created

HttpCacheSlot   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 42
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
supports() 0 1 ?
purgeHttpCache() 0 1 ?
A __construct() 0 4 1
A receive() 0 8 2
1
<?php
2
3
/**
4
 * This file is part of the eZ Publish Kernel package.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Publish\Core\MVC\Symfony\Cache\Http\SignalSlot;
10
11
use eZ\Publish\Core\MVC\Symfony\Cache\GatewayCachePurger;
12
use eZ\Publish\Core\SignalSlot\Signal;
13
use eZ\Publish\Core\SignalSlot\Slot;
14
15
/**
16
 * A abstract legacy slot covering common functions needed for legacy slots.
17
 *
18
 * @deprecated since 6.8. The platform-http-cache package defines slots for http-cache multi-tagging.
19
 */
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