diff --git a/library/Exceptions/SubdivisionCode/BtSubdivisionCodeException.php b/library/Exceptions/SubdivisionCode/BtSubdivisionCodeException.php new file mode 100644 index 00000000..eb1c4459 --- /dev/null +++ b/library/Exceptions/SubdivisionCode/BtSubdivisionCodeException.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 Bhutan subdivision code. + * + * ISO 3166-1 alpha-2: BT + */ +class BtSubdivisionCodeException extends SubdivisionCodeException +{ + public static $defaultTemplates = array( + self::MODE_DEFAULT => array( + self::STANDARD => '{{name}} must be a subdivision code of Bhutan', + ), + self::MODE_NEGATIVE => array( + self::STANDARD => '{{name}} must not be a subdivision code of Bhutan', + ), + ); +} diff --git a/library/Rules/SubdivisionCode/BtSubdivisionCode.php b/library/Rules/SubdivisionCode/BtSubdivisionCode.php new file mode 100644 index 00000000..f7354307 --- /dev/null +++ b/library/Rules/SubdivisionCode/BtSubdivisionCode.php @@ -0,0 +1,49 @@ + + * + * 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 Bhutan subdivision code. + * + * ISO 3166-1 alpha-2: BT + * + * @link http://www.geonames.org/BT/administrative-division-bhutan.html + */ +class BtSubdivisionCode extends AbstractSearcher +{ + public $haystack = array( + '11', // Paro + '12', // Chukha + '13', // Haa + '14', // Samtse + '15', // Thimphu + '21', // Tsirang + '22', // Dagana + '23', // Punakha + '24', // Wangdue Phodrang + '31', // Sarpang + '32', // Trongsa + '33', // Bumthang + '34', // Zhemgang + '41', // Trashigang + '42', // Mongar + '43', // Pemagatshel + '44', // Lhuntse + '45', // Samdrup Jongkhar + 'GA', // Gasa + 'TY', // Trashi Yangste + ); + + public $compareIdentical = true; +}