Create "TzSubdivisionCode" rule

This commit is contained in:
Henrique Moody 2015-09-21 13:27:53 -03:00
parent abd86c54c9
commit e42d1c08da
2 changed files with 86 additions and 0 deletions

View file

@ -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 Tanzania subdivision code.
*
* ISO 3166-1 alpha-2: TZ
*/
class TzSubdivisionCodeException extends SubdivisionCodeException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
self::STANDARD => '{{name}} must be a subdivision code of Tanzania',
),
self::MODE_NEGATIVE => array(
self::STANDARD => '{{name}} must not be a subdivision code of Tanzania',
),
);
}

View file

@ -0,0 +1,55 @@
<?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 Tanzania subdivision code.
*
* ISO 3166-1 alpha-2: TZ
*
* @link http://www.geonames.org/TZ/administrative-division-tanzania.html
*/
class TzSubdivisionCode extends AbstractSearcher
{
public $haystack = array(
'01', // Arusha
'02', // Dar es Salaam
'03', // Dodoma
'04', // Iringa
'05', // Kagera
'06', // Pemba North
'07', // Zanzibar North
'08', // Kigoma
'09', // Kilimanjaro
'10', // Pemba South
'11', // Zanzibar Central/South
'12', // Lindi
'13', // Mara
'14', // Mbeya
'15', // Zanzibar Urban/West
'16', // Morogoro
'17', // Mtwara
'18', // Mwanza
'19', // Pwani
'20', // Rukwa
'21', // Ruvuma
'22', // Shinyanga
'23', // Singida
'24', // Tabora
'25', // Tanga
'26', // Manyara
);
public $compareIdentical = true;
}