diff --git a/library/Exceptions/SubdivisionCode/BoSubdivisionCodeException.php b/library/Exceptions/SubdivisionCode/BoSubdivisionCodeException.php new file mode 100644 index 00000000..239ba5b1 --- /dev/null +++ b/library/Exceptions/SubdivisionCode/BoSubdivisionCodeException.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 Bolivia subdivision code. + * + * ISO 3166-1 alpha-2: BO + */ +class BoSubdivisionCodeException extends SubdivisionCodeException +{ + public static $defaultTemplates = array( + self::MODE_DEFAULT => array( + self::STANDARD => '{{name}} must be a subdivision code of Bolivia', + ), + self::MODE_NEGATIVE => array( + self::STANDARD => '{{name}} must not be a subdivision code of Bolivia', + ), + ); +} diff --git a/library/Rules/SubdivisionCode/BoSubdivisionCode.php b/library/Rules/SubdivisionCode/BoSubdivisionCode.php new file mode 100644 index 00000000..2a955694 --- /dev/null +++ b/library/Rules/SubdivisionCode/BoSubdivisionCode.php @@ -0,0 +1,38 @@ + + * + * 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 Bolivia subdivision code. + * + * ISO 3166-1 alpha-2: BO + * + * @link http://www.geonames.org/BO/administrative-division-bolivia.html + */ +class BoSubdivisionCode extends AbstractSearcher +{ + public $haystack = array( + 'B', // Departmento Beni + 'C', // Departmento Cochabamba + 'H', // Departmento Chuquisaca + 'L', // Departmento La Paz + 'N', // Departmento Pando + 'O', // Departmento Oruro + 'P', // Departmento Potosi + 'S', // Departmento Santa Cruz + 'T', // Departmento Tarija + ); + + public $compareIdentical = true; +}