SingleEndpointFactory::getEndpoint()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
namespace LunixRESTBasics\Endpoint;
3
4
use LunixREST\Server\Router\Endpoint\Endpoint;
5
use LunixREST\Server\Router\EndpointFactory\EndpointFactory;
6
7
/**
8
 * For when you just want a single endpoint to respond to all requests.
9
 * Class SingleEndpointFactory
10
 * @package LunixRESTBasics\Endpoint
11
 */
12
class SingleEndpointFactory implements EndpointFactory
13
{
14
15
    /**
16
     * @var Endpoint
17
     */
18
    private $singleEndpoint;
19
20
    /**
21
     * SingleEndpointFactory constructor.
22
     * @param Endpoint $singleEndpoint
23
     */
24 2
    public function __construct(Endpoint $singleEndpoint)
25
    {
26 2
        $this->singleEndpoint = $singleEndpoint;
27 2
    }
28
29
    /**
30
     * @param string $name
31
     * @param string $version
32
     * @return Endpoint
33
     */
34 1
    public function getEndpoint(string $name, string $version): Endpoint
35
    {
36 1
        return $this->singleEndpoint;
37
    }
38
39
    /**
40
     * @param string $version
41
     * @return string[]
42
     */
43 1
    public function getSupportedEndpoints(string $version): array
44
    {
45 1
        return [];
46
    }
47
}
48