Completed
Push — master ( 35e6b3...305195 )
by John
02:01
created

CachingLoggingEndpointFactory::getEndpoint()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
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 CachingLoggingEndpointFactory
9
 * @package LunixREST\Endpoint
10
 */
11
abstract class CachingLoggingEndpointFactory implements EndpointFactory
12
{
13
    /**
14
     * @var CacheItemPoolInterface
15
     */
16
    protected $cachePool;
17
    /**
18
     * @var LoggerInterface
19
     */
20
    protected $logger;
21
22
    /**
23
     * CachingEndpointFactory constructor.
24
     * @param CacheItemPoolInterface $cachePool
25
     * @param LoggerInterface $logger
26
     */
27 1
    public function __construct(CacheItemPoolInterface $cachePool, LoggerInterface $logger)
28
    {
29 1
        $this->cachePool = $cachePool;
30 1
        $this->logger = $logger;
31 1
    }
32
33
    /**
34
     * @param string $name
35
     * @param string $version
36
     * @return Endpoint
37
     */
38 1
    public function getEndpoint(string $name, string $version): Endpoint
39
    {
40 1
        $endpoint = $this->getCachingLoggingEndpoint($name, $version);
41 1
        $endpoint->setCachePool($this->cachePool);
42 1
        $endpoint->setLogger($this->logger);
43 1
        return $endpoint;
44
    }
45
46
    /**
47
     * @param string $name
48
     * @param string $version
49
     * @return CachingLoggingEndpoint
50
     */
51
    public abstract function getCachingLoggingEndpoint(string $name, string $version): CachingLoggingEndpoint;
0 ignored issues
show
Coding Style introduced by
The abstract declaration must precede the visibility declaration
Loading history...
52
}
53