Punct.php 683 B

12345678910111213141516171819202122232425262728293031
  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 ctype_punct;
  9. /**
  10. * Validates whether the input composed by only punctuation characters.
  11. *
  12. * @author Andre Ramaciotti <andre@ramaciotti.com>
  13. * @author Danilo Correa <danilosilva87@gmail.com>
  14. * @author Henrique Moody <henriquemoody@gmail.com>
  15. * @author Nick Lombard <github@jigsoft.co.za>
  16. */
  17. final class Punct extends AbstractFilterRule
  18. {
  19. /**
  20. * {@inheritDoc}
  21. */
  22. protected function validateFilteredInput(string $input): bool
  23. {
  24. return ctype_punct($input);
  25. }
  26. }