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

CachingEndpointFactory::getLoggingEndpoint()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 2
crap 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