Total Complexity | 2 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class Meta extends BaseModel |
||
8 | { |
||
9 | protected $code; |
||
10 | protected $limit; |
||
11 | protected $remaining; |
||
12 | protected $reset; |
||
13 | |||
14 | /** |
||
15 | * Create new instance of Meta model |
||
16 | * |
||
17 | * @param $data |
||
18 | */ |
||
19 | public function __construct($data) |
||
20 | { |
||
21 | $this->code = (int)$data->code; |
||
22 | $this->limit = (int)$data->headers['X-Rate-Limit-Limit']; |
||
23 | $this->remaining = (int)$data->headers['X-Rate-Limit-Remaining']; |
||
24 | $this->reset = $this->setDate($data); |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * Set remaining seconds till reset as Carbon instance |
||
29 | * |
||
30 | * @param $data |
||
31 | */ |
||
32 | protected function setDate($data) |
||
37 | } |
||
38 | } |
||
39 |