Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
8 / 8 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
| IndexExtensionFilesRequest | |
100.00% |
8 / 8 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
| rules | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| includeExpired | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| page | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| perPage | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Requests\v2\Extension\Admin; |
| 4 | |
| 5 | use App\Http\Requests\v2\Parameter\Concerns\AuthorizesVengresoAdmin; |
| 6 | use Illuminate\Foundation\Http\FormRequest; |
| 7 | |
| 8 | /** |
| 9 | * Request for retrieving GitHub extension files listing |
| 10 | * |
| 11 | * This request handles authorization and validation for the admin endpoint |
| 12 | * that fetches available FlyMSG extension files from GitHub releases and artifacts. |
| 13 | * |
| 14 | * @property bool $include_expired Whether to include expired GitHub artifacts in the response (default: false) |
| 15 | * @property int $page Page number for pagination (default: 1, min: 1) |
| 16 | * @property int $per_page Number of items per page (default: 30, min: 1, max: 100) |
| 17 | */ |
| 18 | class IndexExtensionFilesRequest extends FormRequest |
| 19 | { |
| 20 | use AuthorizesVengresoAdmin; |
| 21 | |
| 22 | /** |
| 23 | * Get the validation rules that apply to the request. |
| 24 | * |
| 25 | * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string> |
| 26 | */ |
| 27 | public function rules(): array |
| 28 | { |
| 29 | return [ |
| 30 | 'include_expired' => 'sometimes|boolean', |
| 31 | 'page' => 'sometimes|integer|min:1', |
| 32 | 'per_page' => 'sometimes|integer|min:1|max:100', |
| 33 | ]; |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Get the validated include_expired parameter with default value |
| 38 | */ |
| 39 | public function includeExpired(): bool |
| 40 | { |
| 41 | return $this->validated()['include_expired'] ?? false; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Get the validated page parameter with default value |
| 46 | */ |
| 47 | public function page(): int |
| 48 | { |
| 49 | return $this->validated()['page'] ?? 1; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Get the validated per_page parameter with default value |
| 54 | */ |
| 55 | public function perPage(): int |
| 56 | { |
| 57 | return $this->validated()['per_page'] ?? 30; |
| 58 | } |
| 59 | } |