Completed
Pull Request — master (#77)
by Michal
01:40
created

RateLimitResponse   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 38
ccs 0
cts 23
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getLimit() 0 4 1
A getRemaining() 0 4 1
A getRetryAfter() 0 4 1
A getErrorResponse() 0 4 1
1
<?php
2
3
namespace Tomaj\NetteApi\RateLimit;
4
5
use Nette\Application\IResponse;
6
7
class RateLimitResponse
8
{
9
    private $limit;
10
11
    private $remaining;
12
13
    private $retryAfter;
14
15
    private $errorResponse;
16
17
    public function __construct(int $limit, int $remaining, ?int $retryAfter = null, ?IResponse $errorResponse = null)
18
    {
19
        $this->limit = $limit;
20
        $this->remaining = $remaining;
21
        $this->retryAfter = $retryAfter;
22
        $this->errorResponse = $errorResponse;
23
    }
24
25
    public function getLimit(): int
26
    {
27
        return $this->limit;
28
    }
29
30
    public function getRemaining(): int
31
    {
32
        return $this->remaining;
33
    }
34
35
    public function getRetryAfter(): ?int
36
    {
37
        return $this->retryAfter;
38
    }
39
40
    public function getErrorResponse(): ?IResponse
41
    {
42
        return $this->errorResponse;
43
    }
44
}
45