error(422, $message, $errors); } final protected function errFobidden(string $message): ServiceResultError { return $this->error(403, $message); } final protected function errNotFound(string $message): ServiceResultError { return $this->error(404, $message); } final protected function errService(string $message): ServiceResultError { return $this->error(500, $message); } final protected function notAcceptable(string $message): ServiceResultError { return $this->error(406, $message); } final protected function ok(string $message = 'OK'): ServiceResultArray { return $this->result(['message' => $message]); } final protected function result(array $data = []): ServiceResultArray { return new ServiceResultArray(data: $data); } final protected function error(int $code, string $message, array $errors = []): ServiceResultError { return new ServiceResultError( message: $message, errors: $errors, code: $code ); } }