From 0e698c0705042cca9565bef33229ea2a5812dfaa Mon Sep 17 00:00:00 2001 From: Henrique Moody Date: Mon, 21 Sep 2015 13:27:24 -0300 Subject: [PATCH] Create "MsSubdivisionCode" rule --- .../MsSubdivisionCodeException.php | 31 +++++++++++++++++++ .../SubdivisionCode/MsSubdivisionCode.php | 28 +++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 library/Exceptions/SubdivisionCode/MsSubdivisionCodeException.php create mode 100644 library/Rules/SubdivisionCode/MsSubdivisionCode.php diff --git a/library/Exceptions/SubdivisionCode/MsSubdivisionCodeException.php b/library/Exceptions/SubdivisionCode/MsSubdivisionCodeException.php new file mode 100644 index 00000000..c8a44314 --- /dev/null +++ b/library/Exceptions/SubdivisionCode/MsSubdivisionCodeException.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the "LICENSE.md" + * file that was distributed with this source code. + */ + +namespace Respect\Validation\Exceptions\SubdivisionCode; + +use Respect\Validation\Exceptions\SubdivisionCodeException; + +/** + * Exception class for Montserrat subdivision code. + * + * ISO 3166-1 alpha-2: MS + */ +class MsSubdivisionCodeException extends SubdivisionCodeException +{ + public static $defaultTemplates = array( + self::MODE_DEFAULT => array( + self::STANDARD => '{{name}} must be a subdivision code of Montserrat', + ), + self::MODE_NEGATIVE => array( + self::STANDARD => '{{name}} must not be a subdivision code of Montserrat', + ), + ); +} diff --git a/library/Rules/SubdivisionCode/MsSubdivisionCode.php b/library/Rules/SubdivisionCode/MsSubdivisionCode.php new file mode 100644 index 00000000..8b72027d --- /dev/null +++ b/library/Rules/SubdivisionCode/MsSubdivisionCode.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the "LICENSE.md" + * file that was distributed with this source code. + */ + +namespace Respect\Validation\Rules\SubdivisionCode; + +use Respect\Validation\Rules\AbstractSearcher; + +/** + * Validator for Montserrat subdivision code. + * + * ISO 3166-1 alpha-2: MS + * + * @link http://www.geonames.org/MS/administrative-division-montserrat.html + */ +class MsSubdivisionCode extends AbstractSearcher +{ + public $haystack = array(null, ''); + + public $compareIdentical = true; +}