Conditions | 4 |
Paths | 3 |
Total Lines | 26 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 16 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
38 | 5 | public function passes($attribute, $value) |
|
39 | { |
||
40 | 5 | if (empty($this->rules)) { |
|
41 | 1 | return true; |
|
42 | } |
||
43 | |||
44 | 4 | $rules = collect($this->rules); |
|
45 | |||
46 | 4 | $checks = $rules->map( |
|
47 | 4 | function ($rule) use ($attribute, $value) { |
|
48 | 4 | $this->rules = $rule; |
|
49 | 4 | $validator = $this->makeValidator($attribute, $value); |
|
50 | |||
51 | 4 | return $validator->fails() ? $validator->errors()->all() : []; |
|
52 | 4 | } |
|
53 | ) |
||
54 | 4 | ->filter() |
|
55 | 4 | ->values(); |
|
56 | |||
57 | 4 | if ($rules->count() == $checks->count()) { |
|
58 | 3 | $this->messages = Arr::wrap($this->message); |
|
59 | |||
60 | 3 | return false; |
|
61 | } |
||
62 | |||
63 | 1 | return true; |
|
64 | } |
||
66 |