Completed
Push — master ( 14565d...9435d2 )
by Shcherbak
09:17
created

CallableHiddenValidator::validate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
  declare(strict_types=1);
4
5
  namespace Fiv\Form\Element\Hidden;
6
7
  use Fiv\Form\Element\Hidden;
8
  use Fiv\Form\Validator\ValidationResultInterface;
9
10
  class CallableHiddenValidator implements HiddenValidatorInterface {
11
12
    /**
13
     * @var callable
14
     */
15
    private $callable;
16
17
18 2
    public function __construct(callable $callable) {
19 2
      $this->callable = $callable;
20 2
    }
21
22 2
    public function validate(Hidden $element) : ValidationResultInterface {
23 2
      $validator = $this->callable;
24 2
      return $validator($element);
25
    }
26
27
  }