Completed
Push — master ( 70e19a...219436 )
by John
02:02
created

CachingEndpointFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 32
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getLoggingEndpoint() 0 6 1
getCachingEndpoint() 0 1 ?
1
<?php
2
namespace LunixREST\Endpoint;
3
4
use Psr\Cache\CacheItemPoolInterface;
5
use Psr\Log\LoggerInterface;
6
7
/**
8
 * Class CachingEndpointFactory
9
 * @package LunixREST\Endpoint
10
 */
11
abstract class CachingEndpointFactory extends LoggingEndpointFactory
12
{
13
    /**
14
     * @var CacheItemPoolInterface
15
     */
16
    protected $cachePool;
17
18
    /**
19
     * CachingEndpointFactory constructor.
20
     * @param CacheItemPoolInterface $cachePool
21
     * @param LoggerInterface $logger
22
     */
23 1
    public function __construct(CacheItemPoolInterface $cachePool, LoggerInterface $logger)
24
    {
25 1
        $this->cachePool = $cachePool;
26 1
        parent::__construct($logger);
27 1
    }
28
29 1
    protected function getLoggingEndpoint(string $name, string $version): LoggingEndpoint
30
    {
31 1
        $endpoint = $this->getCachingEndpoint($name, $version);
32 1
        $endpoint->setCachePool($this->cachePool);
33 1
        return $endpoint;
34
    }
35
36
    /**
37
     * @param string $name
38
     * @param string $version
39
     * @return CachingEndpoint
40
     */
41
    protected abstract function getCachingEndpoint(string $name, string $version): CachingEndpoint;
0 ignored issues
show
Coding Style introduced by
The abstract declaration must precede the visibility declaration
Loading history...
42
}
43