diff --git a/library/Exceptions/SubdivisionCode/PySubdivisionCodeException.php b/library/Exceptions/SubdivisionCode/PySubdivisionCodeException.php new file mode 100644 index 00000000..be74bc76 --- /dev/null +++ b/library/Exceptions/SubdivisionCode/PySubdivisionCodeException.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 Paraguay subdivision code. + * + * ISO 3166-1 alpha-2: PY + */ +class PySubdivisionCodeException extends SubdivisionCodeException +{ + public static $defaultTemplates = array( + self::MODE_DEFAULT => array( + self::STANDARD => '{{name}} must be a subdivision code of Paraguay', + ), + self::MODE_NEGATIVE => array( + self::STANDARD => '{{name}} must not be a subdivision code of Paraguay', + ), + ); +} diff --git a/library/Rules/SubdivisionCode/PySubdivisionCode.php b/library/Rules/SubdivisionCode/PySubdivisionCode.php new file mode 100644 index 00000000..ab825cda --- /dev/null +++ b/library/Rules/SubdivisionCode/PySubdivisionCode.php @@ -0,0 +1,47 @@ + + * + * 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 Paraguay subdivision code. + * + * ISO 3166-1 alpha-2: PY + * + * @link http://www.geonames.org/PY/administrative-division-paraguay.html + */ +class PySubdivisionCode extends AbstractSearcher +{ + public $haystack = array( + '1', // Concepcion + '10', // Alto Parana + '11', // Central + '12', // Neembucu + '13', // Amambay + '14', // Canindeyu + '15', // Presidente Hayes + '16', // Alto Paraguay + '19', // Boqueron + '2', // San Pedro + '3', // Cordillera + '4', // Guaira + '5', // Caaguazu + '6', // Caazapa + '7', // Itapua + '8', // Misiones + '9', // Paraguari + 'ASU', // Asuncion + ); + + public $compareIdentical = true; +}