Completed
Push — master ( 765a46...8c9912 )
by Hector
03:05
created

RateLimit   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 3
c 1
b 1
f 0
lcom 0
cbo 1
dl 0
loc 28
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getRetryAfter() 0 4 1
A getResetAt() 0 4 1
1
<?php
2
3
namespace Hborras\TwitterAdsSDK\TwitterAds\Errors;
4
5
use Exception;
6
use Hborras\TwitterAdsSDK\TwitterAdsException;
7
8
class RateLimit extends TwitterAdsException
9
{
10
    private $retryAfter;
11
    private $resetAt;
12
13
    public function __construct($message, $code, Exception $previous = null, $errors, $headers)
14
    {
15
        parent::__construct($message, $code, null, $errors);
16
        $this->retryAfter = $headers['retry-after'];
17
        $this->resetAt = $headers['rate_limit_reset'];
18
    }
19
20
    /**
21
     * @return mixed
22
     */
23
    public function getRetryAfter()
24
    {
25
        return $this->retryAfter;
26
    }
27
28
    /**
29
     * @return mixed
30
     */
31
    public function getResetAt()
32
    {
33
        return $this->resetAt;
34
    }
35
}
36