Vowel.php 585 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /*
  3. * Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
  4. * SPDX-License-Identifier: MIT
  5. */
  6. declare(strict_types=1);
  7. namespace Respect\Validation\Rules;
  8. use function preg_match;
  9. /**
  10. * Validates whether the input contains only vowels.
  11. *
  12. * @author Henrique Moody <henriquemoody@gmail.com>
  13. * @author Nick Lombard <github@jigsoft.co.za>
  14. */
  15. final class Vowel extends AbstractFilterRule
  16. {
  17. /**
  18. * {@inheritDoc}
  19. */
  20. protected function validateFilteredInput(string $input): bool
  21. {
  22. return preg_match('/^[aeiouAEIOU]+$/', $input) > 0;
  23. }
  24. }