Passed
Push — main ( 6afe0c...47aea4 )
by Breno
01:54
created

ValidateOrFail::validateOrFail()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 2
eloc 2
c 2
b 1
f 0
nc 2
nop 3
dl 0
loc 7
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace BrenoRoosevelt\Validation\Exception;
5
6
use BrenoRoosevelt\Validation\Contracts\Rule;
7
8
trait ValidateOrFail
9
{
10
    use Guard;
11
12
    /**
13
     * @throws ValidationExceptionInterface
14
     */
15
    public function validateOrFail(
16
        mixed $input,
17
        array $context = [],
18
        ValidationExceptionFactoryInterface | ValidationExceptionInterface | string | null $validationException = null
19
    ): void {
20
        if ($this instanceof Rule) {
21
            $this->guardRule($this, $input, $context, $validationException);
22
        }
23
    }
24
}
25