diff --git a/library/Exceptions/SubdivisionCode/NeSubdivisionCodeException.php b/library/Exceptions/SubdivisionCode/NeSubdivisionCodeException.php new file mode 100644 index 00000000..b6de4d74 --- /dev/null +++ b/library/Exceptions/SubdivisionCode/NeSubdivisionCodeException.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 Niger subdivision code. + * + * ISO 3166-1 alpha-2: NE + */ +class NeSubdivisionCodeException extends SubdivisionCodeException +{ + public static $defaultTemplates = array( + self::MODE_DEFAULT => array( + self::STANDARD => '{{name}} must be a subdivision code of Niger', + ), + self::MODE_NEGATIVE => array( + self::STANDARD => '{{name}} must not be a subdivision code of Niger', + ), + ); +} diff --git a/library/Rules/SubdivisionCode/NeSubdivisionCode.php b/library/Rules/SubdivisionCode/NeSubdivisionCode.php new file mode 100644 index 00000000..368fe3d2 --- /dev/null +++ b/library/Rules/SubdivisionCode/NeSubdivisionCode.php @@ -0,0 +1,37 @@ + + * + * 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 Niger subdivision code. + * + * ISO 3166-1 alpha-2: NE + * + * @link http://www.geonames.org/NE/administrative-division-niger.html + */ +class NeSubdivisionCode extends AbstractSearcher +{ + public $haystack = array( + '1', // Agadez + '2', // Diffa + '3', // Dosso + '4', // Maradi + '5', // Tahoua + '6', // Tillabéri + '7', // Zinder + '8', // Niamey + ); + + public $compareIdentical = true; +}