Completed
Push — master ( 98e0f8...788820 )
by Tomas
29s queued 12s
created

Api::getEndpoint()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

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
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Tomaj\NetteApi;
6
7
use Tomaj\NetteApi\Authorization\ApiAuthorizationInterface;
8
use Tomaj\NetteApi\Handlers\ApiHandlerInterface;
9
use Tomaj\NetteApi\RateLimit\NoRateLimit;
10
use Tomaj\NetteApi\RateLimit\RateLimitInterface;
11
12
class Api
13
{
14
    private $endpoint;
15
16
    private $handler;
17
18
    private $authorization;
19
20
    private $rateLimit;
21
22 30
    public function __construct(
23
        EndpointInterface $endpoint,
24
        ApiHandlerInterface $handler,
25
        ApiAuthorizationInterface $authorization,
26
        ?RateLimitInterface $rateLimit = null
27
    ) {
28 30
        $this->endpoint = $endpoint;
29 30
        $this->handler = $handler;
30 30
        $this->authorization = $authorization;
31 30
        $this->rateLimit = $rateLimit ?: new NoRateLimit();
32 30
    }
33
34 27
    public function getEndpoint(): EndpointInterface
35
    {
36 27
        return $this->endpoint;
37
    }
38
39 27
    public function getHandler(): ApiHandlerInterface
40
    {
41 27
        return $this->handler;
42
    }
43
44 24
    public function getAuthorization(): ApiAuthorizationInterface
45
    {
46 24
        return $this->authorization;
47
    }
48
49 12
    public function getRateLimit(): RateLimitInterface
50
    {
51 12
        return $this->rateLimit;
52
    }
53
}
54