2011-10-25 20:06:43 +02:00
|
|
|
<?php
|
2015-06-08 16:47:14 +02:00
|
|
|
|
2015-06-08 17:09:25 +02:00
|
|
|
/*
|
2023-02-17 05:13:51 +01:00
|
|
|
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
|
|
|
|
* SPDX-License-Identifier: MIT
|
2015-06-08 17:09:25 +02:00
|
|
|
*/
|
|
|
|
|
2017-11-19 19:01:31 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2011-10-25 20:06:43 +02:00
|
|
|
namespace Respect\Validation\Rules;
|
|
|
|
|
2018-11-25 17:56:04 +01:00
|
|
|
/**
|
2019-04-05 20:10:13 +02:00
|
|
|
* Validates if the input is a Roman numeral.
|
|
|
|
*
|
2018-11-25 17:56:04 +01:00
|
|
|
* @author Alexander Wühr <wuehr@sc-networks.com>
|
|
|
|
* @author Henrique Moody <henriquemoody@gmail.com>
|
|
|
|
* @author Jean Pimentel <jeanfap@gmail.com>
|
|
|
|
*/
|
2019-02-17 19:59:35 +01:00
|
|
|
final class Roman extends AbstractEnvelope
|
2011-10-25 20:06:43 +02:00
|
|
|
{
|
2015-02-06 18:11:46 +01:00
|
|
|
public function __construct()
|
2013-01-14 22:55:03 +01:00
|
|
|
{
|
2019-04-05 20:10:13 +02:00
|
|
|
parent::__construct(new Regex('/^(?=[MDCLXVI])M*(C[MD]|D?C{0,3})(X[CL]|L?X{0,3})(I[XV]|V?I{0,3})$/'));
|
2011-10-25 20:06:43 +02:00
|
|
|
}
|
2013-01-14 22:55:03 +01:00
|
|
|
}
|