diff --git a/library/Exceptions/SubdivisionCode/CoSubdivisionCodeException.php b/library/Exceptions/SubdivisionCode/CoSubdivisionCodeException.php new file mode 100644 index 00000000..11d9fabc --- /dev/null +++ b/library/Exceptions/SubdivisionCode/CoSubdivisionCodeException.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 Colombia subdivision code. + * + * ISO 3166-1 alpha-2: CO + */ +class CoSubdivisionCodeException extends SubdivisionCodeException +{ + public static $defaultTemplates = array( + self::MODE_DEFAULT => array( + self::STANDARD => '{{name}} must be a subdivision code of Colombia', + ), + self::MODE_NEGATIVE => array( + self::STANDARD => '{{name}} must not be a subdivision code of Colombia', + ), + ); +} diff --git a/library/Rules/SubdivisionCode/CoSubdivisionCode.php b/library/Rules/SubdivisionCode/CoSubdivisionCode.php new file mode 100644 index 00000000..afcb9a9e --- /dev/null +++ b/library/Rules/SubdivisionCode/CoSubdivisionCode.php @@ -0,0 +1,62 @@ + + * + * 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 Colombia subdivision code. + * + * ISO 3166-1 alpha-2: CO + * + * @link http://www.geonames.org/CO/administrative-division-colombia.html + */ +class CoSubdivisionCode extends AbstractSearcher +{ + public $haystack = array( + 'AMA', // Amazonas + 'ANT', // Antioquia + 'ARA', // Arauca + 'ATL', // Atlantico + 'BOL', // Bolivar + 'BOY', // Boyaca + 'CAL', // Caldas + 'CAQ', // Caqueta + 'CAS', // Casanare + 'CAU', // Cauca + 'CES', // Cesar + 'CHO', // Choco + 'COR', // Cordoba + 'CUN', // Cundinamarca + 'DC', // Bogota D.C. + 'GUA', // Guainia + 'GUV', // Guaviare + 'HUI', // Huila + 'LAG', // La Guajira + 'MAG', // Magdalena + 'MET', // Meta + 'NAR', // Narino + 'NSA', // Norte de Santander + 'PUT', // Putumayo + 'QUI', // Quindio + 'RIS', // Risaralda + 'SAN', // Santander + 'SAP', // San Andres y Providencia + 'SUC', // Sucre + 'TOL', // Tolima + 'VAC', // Valle del Cauca + 'VAU', // Vaupes + 'VID', // Vichada + ); + + public $compareIdentical = true; +}