We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
1 | <?php |
||
7 | abstract class AbstractRule implements Validatable |
||
8 | { |
||
9 | protected $name; |
||
10 | protected $template = null; |
||
11 | |||
12 | public static $translator = null; |
||
13 | |||
14 | 641 | public function __construct() |
|
15 | { |
||
16 | //a constructor is required for ReflectionClass::newInstance() |
||
17 | 641 | } |
|
18 | |||
19 | 1014 | public function __invoke($input) |
|
20 | { |
||
21 | 1014 | return !is_a($this, __NAMESPACE__.'\\NotEmpty') |
|
22 | 1014 | && $input === '' || $this->validate($input); |
|
23 | } |
||
24 | |||
25 | 3 | public function addOr() |
|
26 | { |
||
27 | 3 | $rules = func_get_args(); |
|
28 | 3 | array_unshift($rules, $this); |
|
29 | |||
30 | 3 | return new OneOf($rules); |
|
31 | } |
||
32 | |||
33 | 980 | public function assert($input) |
|
40 | |||
41 | 437 | public function check($input) |
|
42 | { |
||
43 | 437 | return $this->assert($input); |
|
44 | } |
||
45 | |||
46 | 135 | public function getName() |
|
50 | |||
51 | 538 | public function reportError($input, array $extraParams = array()) |
|
69 | |||
70 | 34 | public function setName($name) |
|
71 | { |
||
72 | 34 | $this->name = $name; |
|
73 | |||
76 | |||
77 | 3 | public function setTemplate($template) |
|
83 | |||
84 | 538 | protected function createException() |
|
92 | } |
||
93 |