We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Total Complexity | 5 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
27 | final class Yes extends AbstractRule |
||
28 | { |
||
29 | /** |
||
30 | * @var bool |
||
31 | */ |
||
32 | private $useLocale; |
||
33 | |||
34 | /** |
||
35 | * Initializes the rule. |
||
36 | * |
||
37 | * @param bool $useLocale |
||
38 | */ |
||
39 | 3 | public function __construct(bool $useLocale = false) |
|
40 | { |
||
41 | 3 | $this->useLocale = $useLocale; |
|
42 | 3 | } |
|
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | 17 | public function validate($input): bool |
|
48 | { |
||
49 | 17 | if (!is_string($input)) { |
|
50 | 5 | return false; |
|
51 | } |
||
52 | |||
53 | 12 | return preg_match($this->getPattern(), $input) > 0; |
|
54 | } |
||
55 | |||
56 | 12 | private function getPattern(): string |
|
63 | } |
||
64 | } |
||
65 |