Passed
Push — feature/admin-only-job-create ( 4243e9...e9cbd9 )
by Tristan
13:05 queued 07:52
created

JobPosterValidator::validateUnpublished()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 11
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace App\Services\Validation;
4
5
use Illuminate\Support\Facades\Validator;
6
use Illuminate\Validation\Rule;
7
use App\Models\JobPoster;
8
9
class JobPosterValidator
10
{
11
    /**
12
     * Check to see if JobPoster instance has published set to false
13
     *
14
     * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object
1 ignored issue
show
Coding Style Documentation introduced by
Parameter comment must end with a full stop
Loading history...
15
     *
16
     * @return null
1 ignored issue
show
Coding Style introduced by
Function return type is not void, but function has no return statement
Loading history...
17
     */
18 1
    public static function validateUnpublished(JobPoster $jobPoster)
19
    {
20 1
        Validator::make(
21 1
            $jobPoster->toArray(),
22
            [
23
                'published' => [
24 1
                    'required',
25 1
                    Rule::in([false])
26
                ]
27
            ]
28 1
        )->validate();
29 1
    }
30
31
}
32