message; } public function getCode(): ?int { return $this->code; } public function getErrors(): array { return $this->errors; } public function getErrorsOrMessage(): array|string { if (!empty($this->getErrors())) { return $this->getErrors(); } return $this->getMessage(); } public function getData(): array { return [ 'message' => $this->getMessage(), 'errors' => $this->errors ]; } }