Passed
Push — feature/job-builder/criteria-a... ( a8d7d9 )
by Tristan
15:36
created

BatchUpdateCriteria::authorize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace App\Http\Requests;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
use App\Services\Validation\Rules\ValidIdRule;
7
use App\Models\Lookup\CriteriaType;
8
use App\Models\Skill;
9
use App\Models\Lookup\SkillLevel;
10
11
class BatchUpdateCriteria extends FormRequest
12
{
13
    /**
14
     * Determine if the user is authorized to make this request.
15
     *
16
     * @return boolean
17
     */
18
    public function authorize(): bool
19
    {
20
        return true;
21
    }
22
23
    /**
24
     * Get the validation rules that apply to the request.
25
     *
26
     * @return string[]
27
     */
28
    public function rules(): array
29
    {
30
        return [
0 ignored issues
show
Bug Best Practice introduced by
The expression return array('*.id' => '...' => 'nullable|string') returns an array which contains values of type array<integer,App\Servic...les\ValidIdRule|string> which are incompatible with the documented value type string.
Loading history...
31
            '*.id' => 'present',
32
            '*.criteria_type_id' => ['required', new ValidIdRule(CriteriaType::class)],
33
            '*.skill_id' => ['required', new ValidIdRule(Skill::class)],
34
            '*.skill_level_id' => ['required', new ValidIdRule(SkillLevel::class)],
35
            '*.en.description' => 'nullable|string',
36
            '*.en.specificity' => 'nullable|string',
37
            '*.fr.description' => 'nullable|string',
38
            '*.fr.specificity' => 'nullable|string',
39
        ];
40
    }
41
}
42