diff --git a/library/Exceptions/SubdivisionCode/PgSubdivisionCodeException.php b/library/Exceptions/SubdivisionCode/PgSubdivisionCodeException.php new file mode 100644 index 00000000..80fc7885 --- /dev/null +++ b/library/Exceptions/SubdivisionCode/PgSubdivisionCodeException.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 Papua New Guinea subdivision code. + * + * ISO 3166-1 alpha-2: PG + */ +class PgSubdivisionCodeException extends SubdivisionCodeException +{ + public static $defaultTemplates = array( + self::MODE_DEFAULT => array( + self::STANDARD => '{{name}} must be a subdivision code of Papua New Guinea', + ), + self::MODE_NEGATIVE => array( + self::STANDARD => '{{name}} must not be a subdivision code of Papua New Guinea', + ), + ); +} diff --git a/library/Rules/SubdivisionCode/PgSubdivisionCode.php b/library/Rules/SubdivisionCode/PgSubdivisionCode.php new file mode 100644 index 00000000..273a3c42 --- /dev/null +++ b/library/Rules/SubdivisionCode/PgSubdivisionCode.php @@ -0,0 +1,49 @@ + + * + * 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 Papua New Guinea subdivision code. + * + * ISO 3166-1 alpha-2: PG + * + * @link http://www.geonames.org/PG/administrative-division-papua-new-guinea.html + */ +class PgSubdivisionCode extends AbstractSearcher +{ + public $haystack = array( + 'CPK', // Chimbu + 'CPM', // Central + 'EBR', // East New Britain + 'EHG', // Eastern Highlands + 'EPW', // Enga + 'ESW', // East Sepik + 'GPK', // Gulf + 'MBA', // Milne Bay + 'MPL', // Morobe + 'MPM', // Madang + 'MRL', // Manus + 'NCD', // National Capital + 'NIK', // New Ireland + 'NPP', // Northern + 'NSA', // Bougainville + 'SAN', // Sandaun + 'SHM', // Southern Highlands + 'WBK', // West New Britain + 'WHM', // Western Highlands + 'WPD', // Western + ); + + public $compareIdentical = true; +}