diff --git a/library/Exceptions/SubdivisionCode/AdSubdivisionCodeException.php b/library/Exceptions/SubdivisionCode/AdSubdivisionCodeException.php new file mode 100644 index 00000000..858b1dc9 --- /dev/null +++ b/library/Exceptions/SubdivisionCode/AdSubdivisionCodeException.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 Andorra subdivision code. + * + * ISO 3166-1 alpha-2: AD + */ +class AdSubdivisionCodeException extends SubdivisionCodeException +{ + public static $defaultTemplates = array( + self::MODE_DEFAULT => array( + self::STANDARD => '{{name}} must be a subdivision code of Andorra', + ), + self::MODE_NEGATIVE => array( + self::STANDARD => '{{name}} must not be a subdivision code of Andorra', + ), + ); +} diff --git a/library/Rules/SubdivisionCode/AdSubdivisionCode.php b/library/Rules/SubdivisionCode/AdSubdivisionCode.php new file mode 100644 index 00000000..9e5e9dc0 --- /dev/null +++ b/library/Rules/SubdivisionCode/AdSubdivisionCode.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 Andorra subdivision code. + * + * ISO 3166-1 alpha-2: AD + * + * @link http://www.geonames.org/AD/administrative-division-andorra.html + */ +class AdSubdivisionCode extends AbstractSearcher +{ + public $haystack = array( + '02', // Canillo + '03', // Encamp + '04', // La Massana + '05', // Ordino + '06', // Sant Julia de Lòria + '07', // Andorra la Vella + '08', // Escaldes-Engordany + ); + + public $compareIdentical = true; +}