diff --git a/library/Exceptions/SubdivisionCode/JoSubdivisionCodeException.php b/library/Exceptions/SubdivisionCode/JoSubdivisionCodeException.php new file mode 100644 index 00000000..8f558fe8 --- /dev/null +++ b/library/Exceptions/SubdivisionCode/JoSubdivisionCodeException.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 Jordan subdivision code. + * + * ISO 3166-1 alpha-2: JO + */ +class JoSubdivisionCodeException extends SubdivisionCodeException +{ + public static $defaultTemplates = array( + self::MODE_DEFAULT => array( + self::STANDARD => '{{name}} must be a subdivision code of Jordan', + ), + self::MODE_NEGATIVE => array( + self::STANDARD => '{{name}} must not be a subdivision code of Jordan', + ), + ); +} diff --git a/library/Rules/SubdivisionCode/JoSubdivisionCode.php b/library/Rules/SubdivisionCode/JoSubdivisionCode.php new file mode 100644 index 00000000..78b4e74a --- /dev/null +++ b/library/Rules/SubdivisionCode/JoSubdivisionCode.php @@ -0,0 +1,41 @@ + + * + * 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 Jordan subdivision code. + * + * ISO 3166-1 alpha-2: JO + * + * @link http://www.geonames.org/JO/administrative-division-jordan.html + */ +class JoSubdivisionCode extends AbstractSearcher +{ + public $haystack = array( + 'AJ', // Ajlun + 'AM', // 'Amman + 'AQ', // Al 'Aqabah + 'AT', // At Tafilah + 'AZ', // Az Zarqa' + 'BA', // Al Balqa' + 'IR', // Irbid + 'JA', // Jarash + 'KA', // Al Karak + 'MA', // Al Mafraq + 'MD', // Madaba + 'MN', // Ma'an + ); + + public $compareIdentical = true; +}