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

CachingEndpointFactory::getEndpoint()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 6
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 2
crap 2
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