|
@@ 11-19 (lines=9) @@
|
| 8 |
|
|
| 9 |
|
class InvalidQuery extends HttpException |
| 10 |
|
{ |
| 11 |
|
public static function filtersNotAllowed(Collection $unknownFilters, Collection $allowedFilters) |
| 12 |
|
{ |
| 13 |
|
$unknownFilters = $unknownFilters->implode(', '); |
| 14 |
|
$allowedFilters = $allowedFilters->implode(', '); |
| 15 |
|
|
| 16 |
|
$message = "Given filter(s) `{$unknownFilters}` are not allowed. Allowed filters are `{$allowedFilters}`."; |
| 17 |
|
|
| 18 |
|
return new static(Response::HTTP_BAD_REQUEST, $message); |
| 19 |
|
} |
| 20 |
|
|
| 21 |
|
public static function sortsNotAllowed(string $unknownSort, Collection $allowedSorts) |
| 22 |
|
{ |
|
@@ 30-38 (lines=9) @@
|
| 27 |
|
return new static(Response::HTTP_BAD_REQUEST, $message); |
| 28 |
|
} |
| 29 |
|
|
| 30 |
|
public static function includesNotAllowed(Collection $unknownIncludes, Collection $allowedIncludes) |
| 31 |
|
{ |
| 32 |
|
$unknownIncludes = $unknownIncludes->implode(', '); |
| 33 |
|
$allowedIncludes = $allowedIncludes->implode(', '); |
| 34 |
|
|
| 35 |
|
$message = "Given include(s) `{$unknownIncludes}` are not allowed. Allowed includes are `{$allowedIncludes}`."; |
| 36 |
|
|
| 37 |
|
return new static(Response::HTTP_BAD_REQUEST, $message); |
| 38 |
|
} |
| 39 |
|
} |
| 40 |
|
|