diff --git a/library/Exceptions/SubdivisionCode/CfSubdivisionCodeException.php b/library/Exceptions/SubdivisionCode/CfSubdivisionCodeException.php new file mode 100644 index 00000000..0290d03f --- /dev/null +++ b/library/Exceptions/SubdivisionCode/CfSubdivisionCodeException.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 Central African Republic subdivision code. + * + * ISO 3166-1 alpha-2: CF + */ +class CfSubdivisionCodeException extends SubdivisionCodeException +{ + public static $defaultTemplates = array( + self::MODE_DEFAULT => array( + self::STANDARD => '{{name}} must be a subdivision code of Central African Republic', + ), + self::MODE_NEGATIVE => array( + self::STANDARD => '{{name}} must not be a subdivision code of Central African Republic', + ), + ); +} diff --git a/library/Rules/SubdivisionCode/CfSubdivisionCode.php b/library/Rules/SubdivisionCode/CfSubdivisionCode.php new file mode 100644 index 00000000..b6ce0339 --- /dev/null +++ b/library/Rules/SubdivisionCode/CfSubdivisionCode.php @@ -0,0 +1,46 @@ + + * + * 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 Central African Republic subdivision code. + * + * ISO 3166-1 alpha-2: CF + * + * @link http://www.geonames.org/CF/administrative-division-central-african-republic.html + */ +class CfSubdivisionCode extends AbstractSearcher +{ + public $haystack = array( + 'AC', // Ouham + 'BB', // Bamingui-Bangoran + 'BGF', // Bangui + 'BK', // Basse-Kotto + 'HK', // Haute-Kotto + 'HM', // Haut-Mbomou + 'HS', // Mambere-Kadeï + 'KB', // Nana-Grebizi + 'KG', // Kemo + 'LB', // Lobaye + 'MB', // Mbomou + 'MP', // Ombella-M'Poko + 'NM', // Nana-Mambere + 'OP', // Ouham-Pende + 'SE', // Sangha-Mbaere + 'UK', // Ouaka + 'VK', // Vakaga + ); + + public $compareIdentical = true; +}