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

Api   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 0
loc 42
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 2
A getEndpoint() 0 4 1
A getHandler() 0 4 1
A getAuthorization() 0 4 1
A getRateLimit() 0 4 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