Test Failed
Push — master ( 0b650e...b4d0bc )
by Chris
19:25
created

ValidatesWithRespectTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A validation() 0 5 1
1
<?php
2
3
namespace Leonidas\Framework\Site\Form;
4
5
use Psr\Http\Message\ServerRequestInterface;
6
use Respect\Validation\Validatable;
7
use WebTheory\Saveyour\Validation\Validator;
8
9
trait ValidatesWithRespectTrait
10
{
11
    protected function validation(ServerRequestInterface $request): array
12
    {
13
        return array_map(
14
            fn (array $v) => new Validator(...$v),
15
            $this->validatables($request)
16
        );
17
    }
18
19
    /**
20
     * @return array<string,array<Validatable>>
21
     */
22
    abstract protected function validatables(ServerRequestInterface $request): array;
23
}
24