Passed
Pull Request — master (#7)
by Koen
04:19
created

IndexRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 25
ccs 4
cts 4
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A rules() 0 8 1
A authorize() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Http\Requests\Api\User;
6
7
use Illuminate\Foundation\Http\FormRequest;
8
9
final class IndexRequest extends FormRequest
10
{
11
    /**
12
     * Determine if the user is authorized to make this request.
13
     *
14
     * @return bool
15
     */
16 7
    public function authorize(): bool
17
    {
18 7
        return true;
19
    }
20
21
    /**
22
     * Get the validation rules that apply to the request.
23
     *
24
     * @return array
25
     */
26 7
    public function rules(): array
27
    {
28
        return [
29 7
            'name'    => ['sometimes', 'string', 'max:191'],
30
            'email'   => ['sometimes', 'string', 'max:191'],
31
            'sortBy'  => ['sometimes', 'string', 'in:name,email'],
32
            'desc'    => ['sometimes', 'boolean'],
33
            'perPage' => ['sometimes', 'integer', 'min:1', 'max:100'],
34
        ];
35
    }
36
}
37