Passed
Push — task/screening-plan-performanc... ( 402c06...124a4a )
by Tristan
14:18 queued 09:02
created

RatingGuideQuestionRule   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 3
dl 0
loc 9
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A passes() 0 3 1
A message() 0 3 1
1
<?php
2
3
namespace App\Services\Validation\Rules;
4
5
use Illuminate\Contracts\Validation\Rule;
6
use Illuminate\Support\Facades\Lang;
7
use App\Models\RatingGuideQuestion;
8
9
/**
10
 * Validates that value is a valid RatingGuideQuestion id
11
 */
12
class RatingGuideQuestionRule implements Rule
13
{
14
    public function passes($attribute, $value)
1 ignored issue
show
introduced by
Method \App\Services\Validation\Rules\RatingGuideQuestionRule::passes() does not have parameter type hint nor @param annotation for its parameter $attribute.
Loading history...
introduced by
Method \App\Services\Validation\Rules\RatingGuideQuestionRule::passes() does not have parameter type hint nor @param annotation for its parameter $value.
Loading history...
introduced by
Method \App\Services\Validation\Rules\RatingGuideQuestionRule::passes() does not have return type hint nor @return annotation for its return value.
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function passes()
Loading history...
15
    {
16
        return RatingGuideQuestion::where('id', $value)->exists();
0 ignored issues
show
Bug Best Practice introduced by
The expression return App\Models\Rating...'id', $value)->exists() also could return the type Illuminate\Database\Eloquent\Builder which is incompatible with the return type mandated by Illuminate\Contracts\Validation\Rule::passes() of boolean.
Loading history...
17
    }
18
    public function message()
1 ignored issue
show
introduced by
Method \App\Services\Validation\Rules\RatingGuideQuestionRule::message() does not have return type hint nor @return annotation for its return value.
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function message()
Loading history...
19
    {
20
        return Lang::get('validation.invalid_id');
21
    }
22
}
23