diff --git a/library/Exceptions/SubdivisionCode/HtSubdivisionCodeException.php b/library/Exceptions/SubdivisionCode/HtSubdivisionCodeException.php new file mode 100644 index 00000000..06f67195 --- /dev/null +++ b/library/Exceptions/SubdivisionCode/HtSubdivisionCodeException.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 Haiti subdivision code. + * + * ISO 3166-1 alpha-2: HT + */ +class HtSubdivisionCodeException extends SubdivisionCodeException +{ + public static $defaultTemplates = array( + self::MODE_DEFAULT => array( + self::STANDARD => '{{name}} must be a subdivision code of Haiti', + ), + self::MODE_NEGATIVE => array( + self::STANDARD => '{{name}} must not be a subdivision code of Haiti', + ), + ); +} diff --git a/library/Rules/SubdivisionCode/HtSubdivisionCode.php b/library/Rules/SubdivisionCode/HtSubdivisionCode.php new file mode 100644 index 00000000..b4eb389a --- /dev/null +++ b/library/Rules/SubdivisionCode/HtSubdivisionCode.php @@ -0,0 +1,38 @@ + + * + * 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 Haiti subdivision code. + * + * ISO 3166-1 alpha-2: HT + * + * @link http://www.geonames.org/HT/administrative-division-haiti.html + */ +class HtSubdivisionCode extends AbstractSearcher +{ + public $haystack = array( + 'AR', // Artibonite + 'CE', // Centre + 'GA', // Grand'Anse + 'ND', // Nord + 'NE', // Nord-Est + 'NO', // Nord-Ouest + 'OU', // Ouest + 'SD', // Sud + 'SE', // Sud-Est + ); + + public $compareIdentical = true; +}