Test Failed
Push — master ( 0bc352...8c447f )
by Todd
03:54
created

Callback::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Logikos\Util\Validation\Validator;
4
5
6
use Logikos\Util\Validation\Validator;
7
8
class Callback implements Validator {
9
  /**
10
   * @var callable
11
   */
12
  private $callable;
13
  private $description;
14
15
  public function __construct(callable $callable, $description) {
16
    $this->callable    = $callable;
17
    $this->description = $description;
18
  }
19
20
  public function getDescription() {
21
    return $this->description;
22
  }
23
24
  public function validate($value) : bool {
25
    return call_user_func($this->callable, $value);
26
  }
27
}