Passed
Push — feature/job-builder/step-03-ui ( dabf2e...dabf2e )
by Xander
20:05 queued 13s
created

UpdateJobPoster::authorize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace App\Http\Requests;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
use Illuminate\Support\Facades\Config;
7
use App\Services\Validation\Rules\ValidIdRule;
8
use App\Models\Lookup\Department;
9
use App\Models\Lookup\Province;
10
use App\Models\Lookup\SecurityClearance;
11
use App\Models\Lookup\LanguageRequirement;
12
13
class UpdateJobPoster extends FormRequest
14
{
15
    /**
16
     * Determine if the user is authorized to make this request.
17
     *
18
     * @return boolean
19
     */
20 3
    public function authorize(): bool
21
    {
22 3
        return true;
23
    }
24
25
    /**
26
     * Get the validation rules that apply to the request.
27
     *
28
     * @return string[]
29
     */
30 4
    public function rules(): array
31
    {
32 4
        $dateFormat = Config::get('app.api_datetime_format');
33 4
        $dateFormatRule = "date_format:$dateFormat";
34
        return [
0 ignored issues
show
Bug Best Practice introduced by
The expression return array('term_qty' ...' => 'nullable|string') returns an array which contains values of type array<integer,App\Servic...>|array<integer,string> which are incompatible with the documented value type string.
Loading history...
35 4
            'term_qty' => 'nullable|numeric',
36 4
            'open_date_time' =>['nullable', $dateFormatRule],
37 4
            'close_date_time' => ['nullable', $dateFormatRule],
38 4
            'start_date_time' =>['nullable', $dateFormatRule],
39 4
            'department_id' => ['nullable', new ValidIdRule(Department::class)],
40 4
            'province_id' => ['nullable', new ValidIdRule(Province::class)],
41 4
            'security_clearance_id' => ['nullable', new ValidIdRule(SecurityClearance::class)],
42 4
            'language_requirement_id' => ['nullable', new ValidIdRule(LanguageRequirement::class)],
43 4
            'salary_min' => 'nullable|numeric',
44 4
            'salary_max' => 'nullable|numeric',
45 4
            'noc' => 'nullable|numeric',
46 4
            'classification_code' => 'nullable|regex:/[A-Z]{2}/',
47 4
            'classification_level' => 'nullable|numeric',
48 4
            'remote_work_allowed' => 'nullable|boolean',
49 4
            'en.city' => 'nullable|string',
50 4
            'en.title' => 'nullable|string',
51 4
            'en.team_impact' => 'nullable|string',
52 4
            'en.hire_impact' => 'nullable|string',
53 4
            'en.division' => 'nullable|string',
54 4
            'en.branch' => 'nullable|string',
55 4
            'en.education' => 'nullable|string',
56 4
            'fr.city' => 'nullable|string',
57 4
            'fr.title' => 'nullable|string',
58 4
            'fr.team_impact' => 'nullable|string',
59 4
            'fr.hire_impact' => 'nullable|string',
60 4
            'fr.division' => 'nullable|string',
61 4
            'fr.branch' => 'nullable|string',
62 4
            'fr.education' => 'nullable|string',
63
        ];
64
    }
65
}
66