Passed
Push — feature/job_api_route ( e4c64b )
by Tristan
09:17
created

UpdateJobPoster   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 18
dl 0
loc 35
ccs 18
cts 18
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A rules() 0 18 1
A authorize() 0 3 1
1
<?php
2
3
namespace App\Http\Requests;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
use App\Services\Validation\Rules\DepartmentRule;
7
use App\Services\Validation\Rules\ProvinceRule;
8
use App\Services\Validation\Rules\SecurityClearanceRule;
9
use App\Services\Validation\Rules\LanguageRequirementRule;
10
use Illuminate\Support\Facades\Config;
11
12
class UpdateJobPoster extends FormRequest
13
{
14
    /**
15
     * Determine if the user is authorized to make this request.
16
     *
17
     * @return bool
1 ignored issue
show
Coding Style introduced by
Expected "boolean" but found "bool" for function return type
Loading history...
18
     */
19 2
    public function authorize()
0 ignored issues
show
introduced by
Method \App\Http\Requests\UpdateJobPoster::authorize() does not have return type hint for its return value but it should be possible to add it based on @return annotation "bool".
Loading history...
20
    {
21 2
        return true;
22
    }
23
24
    /**
25
     * Get the validation rules that apply to the request.
26
     *
27
     * @return array
0 ignored issues
show
introduced by
@return annotation of method \App\Http\Requests\UpdateJobPoster::rules() does not specify type hint for items of its traversable return value.
Loading history...
28
     */
29 2
    public function rules()
0 ignored issues
show
introduced by
Method \App\Http\Requests\UpdateJobPoster::rules() does not have return type hint for its return value but it should be possible to add it based on @return annotation "array".
Loading history...
30
    {
31 2
        $dateFormat = Config::get('app.api_datetime_format');
32 2
        $dateFormatRule = "date_format:\"$dateFormat\"";
33
        return [
34 2
            'term_qty' => 'required|numeric',
35 2
            'open_date_time' =>["required", $dateFormatRule],
36 2
            'close_date_time' => ["required", $dateFormatRule],
37 2
            'start_date_time' =>["required", $dateFormatRule],
38 2
            'department_id' => ['required', new DepartmentRule()],
39 2
            'province_id' => ['required', new ProvinceRule()],
40 2
            'security_clearance_id' => ['required', new SecurityClearanceRule()],
41 2
            'language_requirement_id' => ['required', new LanguageRequirementRule()],
42 2
            'salary_min' => 'required|numeric',
43 2
            'salary_max' => 'required|numeric',
44 2
            'noc' => 'required|numeric',
45 2
            'classification' => 'required|regex:/[A-Z]{2}-[0-9]{2}/',
46 2
            'remote_work_allowed' => 'required|boolean',
47
        ];
48
    }
49
}
50