Passed
Push — main ( f7f95e...c4cb1e )
by Breno
02:19
created

ValidateOrFailTrait::validateOrFail()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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