| Total Complexity | 3 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | trait Message |
||
| 25 | { |
||
| 26 | use Arrayable; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @inheritDoc |
||
| 30 | */ |
||
| 31 | public static function getDataFromRequest(Request $request): array |
||
| 32 | { |
||
| 33 | return static::getOnlyParamsFromRequest($request, ...static::values()); |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @inheritDoc |
||
| 38 | */ |
||
| 39 | public static function determineIfRequestContainsExtraData(Request $request): bool |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @inheritDoc |
||
| 46 | */ |
||
| 47 | public static function getValidationRules(): array|null |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Get only the specified request params. |
||
| 54 | * |
||
| 55 | * @param Request $request The request |
||
| 56 | * @param int|string ...$values The values |
||
| 57 | * |
||
| 58 | * @return array |
||
| 59 | */ |
||
| 60 | abstract protected static function getOnlyParamsFromRequest(Request $request, int|string ...$values): array; |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Get all request params except the ones specified. |
||
| 64 | * |
||
| 65 | * @param Request $request The request |
||
| 66 | * @param int|string ...$values The values |
||
| 67 | * |
||
| 68 | * @return array |
||
| 69 | */ |
||
| 70 | abstract protected static function getExceptParamsFromRequest(Request $request, int|string ...$values): array; |
||
| 71 | } |
||
| 72 |