diff --git a/library/Exceptions/SubdivisionCode/LsSubdivisionCodeException.php b/library/Exceptions/SubdivisionCode/LsSubdivisionCodeException.php new file mode 100644 index 00000000..6a5117ab --- /dev/null +++ b/library/Exceptions/SubdivisionCode/LsSubdivisionCodeException.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 Lesotho subdivision code. + * + * ISO 3166-1 alpha-2: LS + */ +class LsSubdivisionCodeException extends SubdivisionCodeException +{ + public static $defaultTemplates = array( + self::MODE_DEFAULT => array( + self::STANDARD => '{{name}} must be a subdivision code of Lesotho', + ), + self::MODE_NEGATIVE => array( + self::STANDARD => '{{name}} must not be a subdivision code of Lesotho', + ), + ); +} diff --git a/library/Rules/SubdivisionCode/LsSubdivisionCode.php b/library/Rules/SubdivisionCode/LsSubdivisionCode.php new file mode 100644 index 00000000..384abf50 --- /dev/null +++ b/library/Rules/SubdivisionCode/LsSubdivisionCode.php @@ -0,0 +1,39 @@ + + * + * 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 Lesotho subdivision code. + * + * ISO 3166-1 alpha-2: LS + * + * @link http://www.geonames.org/LS/administrative-division-lesotho.html + */ +class LsSubdivisionCode extends AbstractSearcher +{ + public $haystack = array( + 'A', // Maseru + 'B', // Butha-Buthe + 'C', // Leribe + 'D', // Berea + 'E', // Mafeteng + 'F', // Mohale's Hoek + 'G', // Quthing + 'H', // Qacha's Nek + 'J', // Mokhotlong + 'K', // Thaba-Tseka + ); + + public $compareIdentical = true; +}