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

CachingEndpointFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
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 35
ccs 0
cts 10
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 6 1
getCachingEndpoint() 0 1 ?
1
<?php
2
namespace LunixREST\Endpoint;
3
4
use Psr\Cache\CacheItemPoolInterface;
5
6
/**
7
 * Class CachingEndpointFactory
8
 * @package LunixREST\Endpoint
9
 */
10
abstract class CachingEndpointFactory implements EndpointFactory
11
{
12
    /**
13
     * @var CacheItemPoolInterface
14
     */
15
    protected $cachePool;
16
17
    /**
18
     * CachingEndpointFactory constructor.
19
     * @param CacheItemPoolInterface $cachePool
20
     */
21
    public function __construct(CacheItemPoolInterface $cachePool)
22
    {
23
        $this->cachePool = $cachePool;
24
    }
25
26
    /**
27
     * @param string $name
28
     * @param string $version
29
     * @return Endpoint
30
     */
31
    public function getEndpoint(string $name, string $version): Endpoint
32
    {
33
        $endpoint = $this->getCachingEndpoint($name, $version);
34
        $endpoint->setCachePool($this->cachePool);
35
        return $endpoint;
36
    }
37
38
    /**
39
     * @param string $name
40
     * @param string $version
41
     * @return CachingEndpoint
42
     */
43
    public 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...
44
}
45