| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Yatra\Contracts; |
| 6 |
|
| 7 |
/** |
| 8 |
* Service Interface |
| 9 |
* |
| 10 |
* Defines standard contract for all service classes |
| 11 |
*/ |
| 12 |
interface ServiceInterface |
| 13 |
{ |
| 14 |
/** |
| 15 |
* Get item by ID |
| 16 |
*/ |
| 17 |
public function getById(int $id): ?\stdClass; |
| 18 |
|
| 19 |
/** |
| 20 |
* Get all items with filters |
| 21 |
*/ |
| 22 |
public function getAll(array $filters = []): array; |
| 23 |
|
| 24 |
/** |
| 25 |
* Create new item |
| 26 |
*/ |
| 27 |
public function create(array $data): int; |
| 28 |
|
| 29 |
/** |
| 30 |
* Update existing item |
| 31 |
*/ |
| 32 |
public function update(int $id, array $data): bool; |
| 33 |
|
| 34 |
/** |
| 35 |
* Delete item |
| 36 |
*/ |
| 37 |
public function delete(int $id): bool; |
| 38 |
|
| 39 |
/** |
| 40 |
* Validate data for creation |
| 41 |
*/ |
| 42 |
public function validateCreate(array $data): void; |
| 43 |
|
| 44 |
/** |
| 45 |
* Validate data for update |
| 46 |
*/ |
| 47 |
public function validateUpdate(int $id, array $data): void; |
| 48 |
} |
| 49 |
|