Roman.php 581 B

12345678910111213141516171819202122232425
  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. /**
  9. * Validates if the input is a Roman numeral.
  10. *
  11. * @author Alexander Wühr <wuehr@sc-networks.com>
  12. * @author Henrique Moody <henriquemoody@gmail.com>
  13. * @author Jean Pimentel <jeanfap@gmail.com>
  14. */
  15. final class Roman extends AbstractEnvelope
  16. {
  17. public function __construct()
  18. {
  19. parent::__construct(new Regex('/^(?=[MDCLXVI])M*(C[MD]|D?C{0,3})(X[CL]|L?X{0,3})(I[XV]|V?I{0,3})$/'));
  20. }
  21. }