Completed
Push — master ( 068584...6f6103 )
by John
04:49
created

CachingLoggingEndpointFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 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
    public function __construct(CacheItemPoolInterface $cachePool, LoggerInterface $logger)
0 ignored issues
show
Unused Code introduced by
The parameter $logger is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
28
    {
29
        $this->cachePool = $cachePool;
30
    }
31
32
    /**
33
     * @param string $name
34
     * @param string $version
35
     * @return Endpoint
36
     */
37
    public function getEndpoint(string $name, string $version): Endpoint
38
    {
39
        $endpoint = $this->getCachingLoggingEndpoint($name, $version);
40
        $endpoint->setCachePool($this->cachePool);
41
        $endpoint->setLogger($this->logger);
42
        return $endpoint;
43
    }
44
45
    /**
46
     * @param string $name
47
     * @param string $version
48
     * @return CachingLoggingEndpoint
49
     */
50
    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...
51
}
52