Completed
Push — master ( 31165a...a6c946 )
by Dmytro
04:37
created

CallableAdapter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 25
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A validate() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
5
namespace Paymaxi\Component\Query\Validator\Adapter;
6
7
use Paymaxi\Component\Query\Validator\ValidatorInterface;
8
9
/**
10
 * Class CallableAdapter
11
 *
12
 * @package Paymaxi\Component\Query\Validator\Adapter
13
 */
14
final class CallableAdapter implements ValidatorInterface
15
{
16
    /*** @var callable */
17
    private $callable;
18
19
    /**
20
     * CallableAdapter constructor.
21
     *
22
     * @param callable $callable
23
     */
24 1
    public function __construct(callable $callable)
25
    {
26 1
        $this->callable = $callable;
27 1
    }
28
29
    /**
30
     * @param mixed $value
31
     *
32
     * @return bool
33
     */
34 1
    public function validate($value): bool
35
    {
36 1
        return \call_user_func($this->callable, $value);
37
    }
38
}
39