Introduced ServiceResult and ServiceResultError interfaces, and respective classes with related methods. These changes were necessary to add and handle service results throughout the app. We now have a standard way to return and handle both successes and errors from our services. This leads to cleaner, clearer, and more maintainable code.

This commit is contained in:
2023-06-28 14:36:51 +06:00
parent 20fbdd7a34
commit 00177a134e
5 changed files with 92 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
<?php
declare(strict_types=1);
namespace App\Contracts;
interface ServiceResult
{
public function isSuccess(): bool;
}

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace App\Contracts;
interface ServiceResultError
{
public function getCode(): ?int;
public function getMessage(): string;
public function getErrors(): array;
public function getData(): array;
}