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

ValidateOrFail   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 4
dl 0
loc 14
rs 10
c 2
b 1
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A validateOrFail() 0 7 2
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