keyExists('status'); $this->data = $data; $this->status = (int)$this->data['status']; if ($this->isSuccessful()) { $this->init(); } } /** * @return bool */ public function isSuccessful(): bool { return $this->status >= 200 && $this->status < 300; } public function getError(): string { return $this->isSuccessful() ? '' : $this->data['message']; } }