We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Total Complexity | 8 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Coverage | 88.89% |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | abstract class AbstractRule implements Validatable |
||
| 22 | { |
||
| 23 | protected $name; |
||
| 24 | protected $template; |
||
| 25 | |||
| 26 | 2 | public function __invoke($input) |
|
| 27 | { |
||
| 28 | 2 | return $this->validate($input); |
|
| 29 | } |
||
| 30 | |||
| 31 | 2 | public function assert($input) |
|
| 32 | { |
||
| 33 | 2 | if ($this->validate($input)) { |
|
| 34 | 1 | return true; |
|
| 35 | } |
||
| 36 | |||
| 37 | 1 | throw $this->reportError($input); |
|
| 38 | } |
||
| 39 | |||
| 40 | 1 | public function check($input) |
|
| 41 | { |
||
| 42 | 1 | return $this->assert($input); |
|
| 43 | } |
||
| 44 | |||
| 45 | 15 | public function getName() |
|
| 48 | } |
||
| 49 | |||
| 50 | public function reportError($input, array $extraParams = []) |
||
| 51 | { |
||
| 52 | return Factory::getDefaultInstance()->exception($this, $input, $extraParams); |
||
| 53 | } |
||
| 54 | |||
| 55 | 14 | public function setName($name) |
|
| 60 | } |
||
| 61 | |||
| 62 | 1 | public function setTemplate($template) |
|
| 67 | } |
||
| 68 | } |
||
| 69 |