diff --git a/library/Exceptions/SubdivisionCode/SzSubdivisionCodeException.php b/library/Exceptions/SubdivisionCode/SzSubdivisionCodeException.php new file mode 100644 index 00000000..ee66a8ac --- /dev/null +++ b/library/Exceptions/SubdivisionCode/SzSubdivisionCodeException.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 Swaziland subdivision code. + * + * ISO 3166-1 alpha-2: SZ + */ +class SzSubdivisionCodeException extends SubdivisionCodeException +{ + public static $defaultTemplates = array( + self::MODE_DEFAULT => array( + self::STANDARD => '{{name}} must be a subdivision code of Swaziland', + ), + self::MODE_NEGATIVE => array( + self::STANDARD => '{{name}} must not be a subdivision code of Swaziland', + ), + ); +} diff --git a/library/Rules/SubdivisionCode/SzSubdivisionCode.php b/library/Rules/SubdivisionCode/SzSubdivisionCode.php new file mode 100644 index 00000000..135575df --- /dev/null +++ b/library/Rules/SubdivisionCode/SzSubdivisionCode.php @@ -0,0 +1,33 @@ + + * + * 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 Swaziland subdivision code. + * + * ISO 3166-1 alpha-2: SZ + * + * @link http://www.geonames.org/SZ/administrative-division-swaziland.html + */ +class SzSubdivisionCode extends AbstractSearcher +{ + public $haystack = array( + 'HH', // Hhohho + 'LU', // Lubombo + 'MA', // Manzini + 'SH', // Shishelweni + ); + + public $compareIdentical = true; +}