mirror of
https://github.com/Respect/Validation.git
synced 2024-06-29 10:40:24 +02:00
Create "ToSubdivisionCode" rule
This commit is contained in:
parent
7757a00503
commit
aef7c856c4
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Respect/Validation.
|
||||
*
|
||||
* (c) Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
||||
*
|
||||
* 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 Tonga subdivision code.
|
||||
*
|
||||
* ISO 3166-1 alpha-2: TO
|
||||
*/
|
||||
class ToSubdivisionCodeException extends SubdivisionCodeException
|
||||
{
|
||||
public static $defaultTemplates = array(
|
||||
self::MODE_DEFAULT => array(
|
||||
self::STANDARD => '{{name}} must be a subdivision code of Tonga',
|
||||
),
|
||||
self::MODE_NEGATIVE => array(
|
||||
self::STANDARD => '{{name}} must not be a subdivision code of Tonga',
|
||||
),
|
||||
);
|
||||
}
|
34
library/Rules/SubdivisionCode/ToSubdivisionCode.php
Normal file
34
library/Rules/SubdivisionCode/ToSubdivisionCode.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Respect/Validation.
|
||||
*
|
||||
* (c) Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
||||
*
|
||||
* 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 Tonga subdivision code.
|
||||
*
|
||||
* ISO 3166-1 alpha-2: TO
|
||||
*
|
||||
* @link http://www.geonames.org/TO/administrative-division-tonga.html
|
||||
*/
|
||||
class ToSubdivisionCode extends AbstractSearcher
|
||||
{
|
||||
public $haystack = array(
|
||||
'01', // Eua
|
||||
'02', // Ha'apai
|
||||
'03', // Niuas
|
||||
'04', // Tongatapu
|
||||
'05', // Vava'u
|
||||
);
|
||||
|
||||
public $compareIdentical = true;
|
||||
}
|
Loading…
Reference in a new issue