__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 3
crap 1
1
<?php
2
namespace LunixRESTBasics\Endpoint;
3
4
use Doctrine\Common\Persistence\ManagerRegistry;
5
use LunixREST\Server\Router\Endpoint\CachingEndpoint;
6
use LunixREST\Server\Router\EndpointFactory\CachingEndpointFactory;
7
use Psr\Cache\CacheItemPoolInterface;
8
use Psr\Log\LoggerInterface;
9
10
/**
11
 * Class ManagerRegistryCachingEndpointFactory
12
 * @package LunixRESTBasics\Endpoint
13
 * @deprecated in favor of the actual EndpointFactory injecting the ManagerRegistry.
14
 */
15
abstract class ManagerRegistryCachingEndpointFactory extends CachingEndpointFactory
0 ignored issues
show
Deprecated Code introduced by
The class LunixREST\Server\Router\...\CachingEndpointFactory has been deprecated with message: in favor of injecting the CacheItemPoolInterface manually in EndpointFactories. This adds no additional value.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
16
{
17
    /**
18
     * @var ManagerRegistry
19
     */
20
    protected $managerRegistry;
21
22
    /**
23
     * ManagerRegistryCachingEndpointFactory constructor.
24
     * @param ManagerRegistry $managerRegistry
25
     * @param CacheItemPoolInterface $cachePool
26
     * @param LoggerInterface $logger
27
     */
28 1
    public function __construct(ManagerRegistry $managerRegistry, CacheItemPoolInterface $cachePool, LoggerInterface $logger)
29
    {
30 1
        $this->managerRegistry = $managerRegistry;
31 1
        parent::__construct($cachePool,$logger);
32 1
    }
33
34
    /**
35
     * @param string $name
36
     * @param string $version
37
     * @return CachingEndpoint
38
     */
39 1
    protected function getCachingEndpoint(string $name, string $version): CachingEndpoint
40
    {
41 1
        $endpoint = $this->getManagerRegistryCachingEndpoint($name, $version);
42 1
        $endpoint->setManagerRegistry($this->managerRegistry);
43 1
        return $endpoint;
44
    }
45
46
    /**
47
     * @param string $name
48
     * @param string $version
49
     * @return ManagerRegistryCachingEndpoint
50
     */
51
    protected abstract function getManagerRegistryCachingEndpoint(string $name, string $version): ManagerRegistryCachingEndpoint;
0 ignored issues
show
Coding Style introduced by
The abstract declaration must precede the visibility declaration
Loading history...
52
}
53