Completed
Push — bug/accordion ( 6550f4...474aef )
by Grant
12:54 queued 07:32
created

BaseDataValidator::validate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace App\Services\Validation;
4
5
use App\Services\Validation\Contracts\DataValidator;
6
7
abstract class BaseDataValidator implements DataValidator
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class BaseDataValidator
Loading history...
8
{
9
    /**
10
     * Runs the validator, redirecting back, with errors, if validation fails.
11
     *
12
     * @param mixed[] $data The data to validate.
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
13
     * @return void
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
14
     */
15
    public function validate(array $data): void
16
    {
17
        $this->validator($data)->validate();
18
    }
19
20
    /**
21
     * Returns true if the validator passes
22
     *
23
     * @param mixed[] $data Data to validate.
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
24
     * @return boolean
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
25
     */
26 18
    public function isValid(array $data) : bool
27
    {
28 18
        return $this->validator($data)->passes();
29
    }
30
}
31