From be75e82c9767ea376076c81429bda4a668f85353 Mon Sep 17 00:00:00 2001 From: Henrique Moody Date: Mon, 21 Sep 2015 13:26:45 -0300 Subject: [PATCH] Create "BvSubdivisionCode" rule --- .../BvSubdivisionCodeException.php | 31 +++++++++++++++++++ .../SubdivisionCode/BvSubdivisionCode.php | 28 +++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 library/Exceptions/SubdivisionCode/BvSubdivisionCodeException.php create mode 100644 library/Rules/SubdivisionCode/BvSubdivisionCode.php diff --git a/library/Exceptions/SubdivisionCode/BvSubdivisionCodeException.php b/library/Exceptions/SubdivisionCode/BvSubdivisionCodeException.php new file mode 100644 index 00000000..34d778ad --- /dev/null +++ b/library/Exceptions/SubdivisionCode/BvSubdivisionCodeException.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 Bouvet Island subdivision code. + * + * ISO 3166-1 alpha-2: BV + */ +class BvSubdivisionCodeException extends SubdivisionCodeException +{ + public static $defaultTemplates = array( + self::MODE_DEFAULT => array( + self::STANDARD => '{{name}} must be a subdivision code of Bouvet Island', + ), + self::MODE_NEGATIVE => array( + self::STANDARD => '{{name}} must not be a subdivision code of Bouvet Island', + ), + ); +} diff --git a/library/Rules/SubdivisionCode/BvSubdivisionCode.php b/library/Rules/SubdivisionCode/BvSubdivisionCode.php new file mode 100644 index 00000000..6c0e44af --- /dev/null +++ b/library/Rules/SubdivisionCode/BvSubdivisionCode.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 Bouvet Island subdivision code. + * + * ISO 3166-1 alpha-2: BV + * + * @link http://www.geonames.org/BV/administrative-division-bouvet-island.html + */ +class BvSubdivisionCode extends AbstractSearcher +{ + public $haystack = array(null, ''); + + public $compareIdentical = true; +}