diff --git a/library/Exceptions/SubdivisionCode/CdSubdivisionCodeException.php b/library/Exceptions/SubdivisionCode/CdSubdivisionCodeException.php new file mode 100644 index 00000000..774a7a18 --- /dev/null +++ b/library/Exceptions/SubdivisionCode/CdSubdivisionCodeException.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 Democratic Republic of the Congo subdivision code. + * + * ISO 3166-1 alpha-2: CD + */ +class CdSubdivisionCodeException extends SubdivisionCodeException +{ + public static $defaultTemplates = array( + self::MODE_DEFAULT => array( + self::STANDARD => '{{name}} must be a subdivision code of Democratic Republic of the Congo', + ), + self::MODE_NEGATIVE => array( + self::STANDARD => '{{name}} must not be a subdivision code of Democratic Republic of the Congo', + ), + ); +} diff --git a/library/Rules/SubdivisionCode/CdSubdivisionCode.php b/library/Rules/SubdivisionCode/CdSubdivisionCode.php new file mode 100644 index 00000000..cf66541b --- /dev/null +++ b/library/Rules/SubdivisionCode/CdSubdivisionCode.php @@ -0,0 +1,40 @@ + + * + * 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 Democratic Republic of the Congo subdivision code. + * + * ISO 3166-1 alpha-2: CD + * + * @link http://www.geonames.org/CD/administrative-division-democratic-republic-of-the-congo.html + */ +class CdSubdivisionCode extends AbstractSearcher +{ + public $haystack = array( + 'BC', // Bas-Congo + 'BN', // Bandundu + 'EQ', // Equateur + 'KA', // Katanga + 'KE', // Kasai-Oriental + 'KN', // Kinshasa + 'KW', // Kasai-Occidental + 'MA', // Maniema + 'NK', // Nord-Kivu + 'OR', // Orientale + 'SK', // Sud-Kivu + ); + + public $compareIdentical = true; +}