diff --git a/library/Exceptions/SubdivisionCode/GdSubdivisionCodeException.php b/library/Exceptions/SubdivisionCode/GdSubdivisionCodeException.php new file mode 100644 index 00000000..589a6354 --- /dev/null +++ b/library/Exceptions/SubdivisionCode/GdSubdivisionCodeException.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 Grenada subdivision code. + * + * ISO 3166-1 alpha-2: GD + */ +class GdSubdivisionCodeException extends SubdivisionCodeException +{ + public static $defaultTemplates = array( + self::MODE_DEFAULT => array( + self::STANDARD => '{{name}} must be a subdivision code of Grenada', + ), + self::MODE_NEGATIVE => array( + self::STANDARD => '{{name}} must not be a subdivision code of Grenada', + ), + ); +} diff --git a/library/Rules/SubdivisionCode/GdSubdivisionCode.php b/library/Rules/SubdivisionCode/GdSubdivisionCode.php new file mode 100644 index 00000000..c8cc6376 --- /dev/null +++ b/library/Rules/SubdivisionCode/GdSubdivisionCode.php @@ -0,0 +1,36 @@ + + * + * 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 Grenada subdivision code. + * + * ISO 3166-1 alpha-2: GD + * + * @link http://www.geonames.org/GD/administrative-division-grenada.html + */ +class GdSubdivisionCode extends AbstractSearcher +{ + public $haystack = array( + '01', // Saint Andrew + '02', // Saint David + '03', // Saint George + '04', // Saint John + '05', // Saint Mark + '06', // Saint Patrick + '10', // Southern Grenadine Islands + ); + + public $compareIdentical = true; +}