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 | 7 | public function __construct(bool $useLocale = false) |
|
| 40 | { |
||
| 41 | 7 | $this->useLocale = $useLocale; |
|
| 42 | 7 | } |
|
| 43 | |||
| 44 | /** |
||
| 45 | * {@inheritdoc} |
||
| 46 | */ |
||
| 47 | 21 | public function validate($input): bool |
|
| 48 | { |
||
| 49 | 21 | if (!is_string($input)) { |
|
| 50 | 5 | return false; |
|
| 51 | } |
||
| 52 | |||
| 53 | 16 | return preg_match($this->getPattern(), $input) > 0; |
|
| 54 | } |
||
| 55 | |||
| 56 | 16 | private function getPattern(): string |
|
| 63 | } |
||
| 64 | } |
||
| 65 |