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