1 | <?php |
||
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; |
||
44 | } |
||
45 |