View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFPROP:Proposal Zone Template}

{zone-data:component-name}
Zend_Validate_PostCode
{zone-data}

{zone-data:proposer-list}
[~thomas]
{zone-data}

{zone-data:liaison}
TBD
{zone-data}

{zone-data:revision}
1.0 - 7 June 2009: Initial Draft.
{zone-data}

{zone-data:overview}
Zend_Validate_PostCode is a compnent which will validate if a given string conforms a post code from any region within the world.
{zone-data}

{zone-data:references}
* [Wikipedia-Postal code|http://en.wikipedia.org/wiki/Postal_code]
{zone-data}

{zone-data:requirements}
* This component *will* support postal codes from all countries
* This component *will* only validate
* This component *will not* change the notation of the input
* This component *will not* 100% detect if a given postal code exists or not
{zone-data}

{zone-data:dependencies}
* Zend_Exception
* Zend_Locale
{zone-data}

{zone-data:operation}
This component uses Zend_Locale to get the postal code informations for all known countries. These are then used to detect if the given input is a postal code or not. This component can not detect if a given postal code exists or not. It only checks if a given input can be a postal code, if the notation conforms, or not.
{zone-data}

{zone-data:milestones}
* Milestone 1: \[DONE\] Proposal finished
* Milestone 2: \[DONE\] Proposal accepted
* Milestone 3: \[DONE\] Coding finished
* Milestone 4: \[DONE\] Unit tests finished
* Milestone 5: \[DONE\] Documentation finished
* Milestone 6: \[DONE\] Component moved to core
{zone-data}

{zone-data:class-list}
* Zend_Validate_PostCode
{zone-data}

{zone-data:use-cases}
||UC-01||
Uses set application wide locale to detect the region to use
{code}
$validator = new Zend_Validate_PostCode();
$validator->isValid('AT-1234');
{code}
||UC-02||
Sets a region where the postal code is related to
{code}
$validator = new Zend_Validate_PostCode(array('locale' => 'de_AT'));
$validator->isValid('AT-1234');
{code}
or set it afterwards
{code}
$validator = new Zend_Validate_PostCode();
$validator->setLocale('de_AT');
$validator->isValid('AT-1234');
{code}
||UC-03||
Sets a self defined format for postal code validation
{code}
$validator = new Zend_Validate_PostCode(array('format' => '/^[0-9]{5-7}'));
$validator->isValid('12345');
{code}
{zone-data}

{zone-data:skeletons}
{code}
class Zend_Validate_PostCode {
public function __construct($options);
public function getLocale();
public function setLocale();
public function getFormat();
public function setFormat();
public function isValid($input);
}
{code}
{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>