Completed
Push — master ( 283745...8baa4f )
by André
49:49 queued 25:19
created

AbstractInMemoryPersistenceHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A init() 0 4 1
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
namespace eZ\Publish\Core\Persistence\Cache;
8
9
use eZ\Publish\Core\Persistence\Cache\Adapter\InMemoryClearingProxyAdapter;
10
use eZ\Publish\Core\Persistence\Cache\InMemory\InMemoryCache;
11
use eZ\Publish\SPI\Persistence\Handler as PersistenceHandler;
12
13
/**
14
 * Internal abstract handler for use in other SPI Persistence Cache Handlers.
15
 *
16
 * @internal Only for use as abstract in eZ\Publish\Core\Persistence\Cache\*Handlers.
17
 */
18
abstract class AbstractInMemoryPersistenceHandler extends AbstractInMemoryHandler
19
{
20
    /**
21
     * @var \eZ\Publish\SPI\Persistence\Handler
22
     */
23
    protected $persistenceHandler;
24
25
    /**
26
     * Setups current handler with everything needed.
27
     *
28
     * @param \eZ\Publish\Core\Persistence\Cache\Adapter\InMemoryClearingProxyAdapter $cache
29
     * @param \eZ\Publish\Core\Persistence\Cache\PersistenceLogger $logger
30
     * @param \eZ\Publish\Core\Persistence\Cache\InMemory\InMemoryCache $inMemory
31
     * @param \eZ\Publish\SPI\Persistence\Handler $persistenceHandler
32
     */
33
    public function __construct(
34
        InMemoryClearingProxyAdapter $cache,
35
        PersistenceLogger $logger,
36
        InMemoryCache $inMemory,
37
        PersistenceHandler $persistenceHandler
38
    ) {
39
        parent::__construct($cache, $logger, $inMemory);
40
        $this->persistenceHandler = $persistenceHandler;
41
42
        $this->init();
43
    }
44
45
    /**
46
     * Optional function to initialize handler without having to overload __construct().
47
     */
48
    protected function init(): void
49
    {
50
        // overload to add init logic if needed in handler
51
    }
52
}
53