From 5fbbbb08e28d9b78998b4541f3b289811f328a55 Mon Sep 17 00:00:00 2001 From: Henrique Moody Date: Mon, 21 Sep 2015 13:27:34 -0300 Subject: [PATCH] Create "PnSubdivisionCode" rule --- .../PnSubdivisionCodeException.php | 31 +++++++++++++++++++ .../SubdivisionCode/PnSubdivisionCode.php | 28 +++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 library/Exceptions/SubdivisionCode/PnSubdivisionCodeException.php create mode 100644 library/Rules/SubdivisionCode/PnSubdivisionCode.php diff --git a/library/Exceptions/SubdivisionCode/PnSubdivisionCodeException.php b/library/Exceptions/SubdivisionCode/PnSubdivisionCodeException.php new file mode 100644 index 00000000..00b7ad2a --- /dev/null +++ b/library/Exceptions/SubdivisionCode/PnSubdivisionCodeException.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 Pitcairn Islands subdivision code. + * + * ISO 3166-1 alpha-2: PN + */ +class PnSubdivisionCodeException extends SubdivisionCodeException +{ + public static $defaultTemplates = array( + self::MODE_DEFAULT => array( + self::STANDARD => '{{name}} must be a subdivision code of Pitcairn Islands', + ), + self::MODE_NEGATIVE => array( + self::STANDARD => '{{name}} must not be a subdivision code of Pitcairn Islands', + ), + ); +} diff --git a/library/Rules/SubdivisionCode/PnSubdivisionCode.php b/library/Rules/SubdivisionCode/PnSubdivisionCode.php new file mode 100644 index 00000000..155cee56 --- /dev/null +++ b/library/Rules/SubdivisionCode/PnSubdivisionCode.php @@ -0,0 +1,28 @@ + + * + * 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 Pitcairn Islands subdivision code. + * + * ISO 3166-1 alpha-2: PN + * + * @link http://www.geonames.org/PN/administrative-division-pitcairn-islands.html + */ +class PnSubdivisionCode extends AbstractSearcher +{ + public $haystack = array(null, ''); + + public $compareIdentical = true; +}