diff --git a/library/Exceptions/SubdivisionCode/BaSubdivisionCodeException.php b/library/Exceptions/SubdivisionCode/BaSubdivisionCodeException.php new file mode 100644 index 00000000..a26d5ca0 --- /dev/null +++ b/library/Exceptions/SubdivisionCode/BaSubdivisionCodeException.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 Bosnia and Herzegovina subdivision code. + * + * ISO 3166-1 alpha-2: BA + */ +class BaSubdivisionCodeException extends SubdivisionCodeException +{ + public static $defaultTemplates = array( + self::MODE_DEFAULT => array( + self::STANDARD => '{{name}} must be a subdivision code of Bosnia and Herzegovina', + ), + self::MODE_NEGATIVE => array( + self::STANDARD => '{{name}} must not be a subdivision code of Bosnia and Herzegovina', + ), + ); +} diff --git a/library/Rules/SubdivisionCode/BaSubdivisionCode.php b/library/Rules/SubdivisionCode/BaSubdivisionCode.php new file mode 100644 index 00000000..540fdacf --- /dev/null +++ b/library/Rules/SubdivisionCode/BaSubdivisionCode.php @@ -0,0 +1,42 @@ + + * + * 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 Bosnia and Herzegovina subdivision code. + * + * ISO 3166-1 alpha-2: BA + * + * @link http://www.geonames.org/BA/administrative-division-bosnia-and-herzegovina.html + */ +class BaSubdivisionCode extends AbstractSearcher +{ + public $haystack = array( + 'BIH', // Federacija Bosna i Hercegovina + 'BRC', // Brcko District + 'SRP', // Republika Srpska + '01', // Unsko-sanski kanton + '02', // Posavski kanton + '03', // Tuzlanski kanton + '04', // Zeničko-dobojski kanton + '05', // Bosansko-podrinjski kanton + '06', // Srednjobosanski kantonn + '07', // Hercegovačko-neretvanski kanton + '08', // Zapadnohercegovački kanton + '09', // Kanton Sarajevo + '10', // Kanton br. 10 (Livanjski kanton) + ); + + public $compareIdentical = true; +}