| 1 | <?php |
||
| 9 | abstract class UniqueEntityCollection extends EntityCollection |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @param $entity |
||
| 13 | * @return string |
||
| 14 | */ |
||
| 15 | abstract public function entityUniqueId($entity): string; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @param $entity |
||
| 19 | * @throws \Exception |
||
| 20 | */ |
||
| 21 | 6 | public function add($entity) |
|
| 31 | |||
| 32 | /** |
||
| 33 | * @param $entity |
||
| 34 | * @return bool |
||
| 35 | */ |
||
| 36 | 5 | public function exist($entity): bool |
|
| 44 | |||
| 45 | /** |
||
| 46 | * @param $entity |
||
| 47 | * @return string |
||
| 48 | * @throws \Exception |
||
| 49 | */ |
||
| 50 | 5 | private function uniqueId($entity): string |
|
| 59 | |||
| 60 | /** |
||
| 61 | * @return \Exception |
||
| 62 | */ |
||
| 63 | 2 | public static function customDuplicateEntityException(): \Exception |
|
| 67 | |||
| 68 | |||
| 69 | /** |
||
| 70 | * @return \Exception |
||
| 71 | */ |
||
| 72 | 1 | public static function customInvalidEntityIdException(): \Exception |
|
| 76 | } |
||
| 77 |