Completed
Push — master ( 6f6103...35e6b3 )
by John
02:33 queued 39s
created

CachingEndpointFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
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 35
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
getCachingEndpoint() 0 1 ?
A __construct() 0 4 1
A getEndpoint() 0 6 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 1
    public function __construct(CacheItemPoolInterface $cachePool)
22
    {
23 1
        $this->cachePool = $cachePool;
24 1
    }
25
26
    /**
27
     * @param string $name
28
     * @param string $version
29
     * @return Endpoint
30
     */
31 1
    public function getEndpoint(string $name, string $version): Endpoint
32
    {
33 1
        $endpoint = $this->getCachingEndpoint($name, $version);
34 1
        $endpoint->setCachePool($this->cachePool);
35 1
        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