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

CachingLoggingEndpointFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getEndpoint() 0 7 1
getCachingLoggingEndpoint() 0 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