diff --git a/library/Exceptions/SubdivisionCode/CySubdivisionCodeException.php b/library/Exceptions/SubdivisionCode/CySubdivisionCodeException.php new file mode 100644 index 00000000..275f9ce6 --- /dev/null +++ b/library/Exceptions/SubdivisionCode/CySubdivisionCodeException.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 Cyprus subdivision code. + * + * ISO 3166-1 alpha-2: CY + */ +class CySubdivisionCodeException extends SubdivisionCodeException +{ + public static $defaultTemplates = array( + self::MODE_DEFAULT => array( + self::STANDARD => '{{name}} must be a subdivision code of Cyprus', + ), + self::MODE_NEGATIVE => array( + self::STANDARD => '{{name}} must not be a subdivision code of Cyprus', + ), + ); +} diff --git a/library/Rules/SubdivisionCode/CySubdivisionCode.php b/library/Rules/SubdivisionCode/CySubdivisionCode.php new file mode 100644 index 00000000..0dac2748 --- /dev/null +++ b/library/Rules/SubdivisionCode/CySubdivisionCode.php @@ -0,0 +1,35 @@ + + * + * 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 Cyprus subdivision code. + * + * ISO 3166-1 alpha-2: CY + * + * @link http://www.geonames.org/CY/administrative-division-cyprus.html + */ +class CySubdivisionCode extends AbstractSearcher +{ + public $haystack = array( + '01', // Lefkosía + '02', // Lemesós + '03', // Lárnaka + '04', // Ammóchostos + '05', // Páfos + '06', // Kerýneia + ); + + public $compareIdentical = true; +}