PHP Class PostCodeUtility

(C) Moorfields Eye Hospital NHS Foundation Trust, 2008-2011 (C) OpenEyes Foundation, 2011-2013 This file is part of OpenEyes. OpenEyes is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenEyes is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenEyes in a file titled COPYING. If not, see .
Author: OpenEyes ([email protected])
Show file Open project: openeyes/openeyes

Public Properties

Property Type Description
$counties
$towns

Public Methods

Method Description
__construct ( )
countyForOuterPostCode ( string $_code ) : string Returns county for an outer post code.
isCounty ( string $_string ) : boolean Is the passed string a county?
isTown ( $_string ) : boolean Returns county for an outer post code.
parsePostCode ( string $_string ) : array | false Cleans string, tests that is is postcode, return associative array with components, or false if not valid.
townForOuterPostCode ( string $_code ) : string Returns town for an outer post code.

Method Details

__construct() public method

public __construct ( )

countyForOuterPostCode() public method

Returns county for an outer post code.
public countyForOuterPostCode ( string $_code ) : string
$_code string Outer postcode
return string County name

isCounty() public method

Is the passed string a county?
public isCounty ( string $_string ) : boolean
$_string string Possible County
return boolean

isTown() public method

Returns county for an outer post code.
public isTown ( $_string ) : boolean
return boolean

parsePostCode() public method

Cleans string, tests that is is postcode, return associative array with components, or false if not valid.
public parsePostCode ( string $_string ) : array | false
$_string string Possible postcode string
return array | false

townForOuterPostCode() public method

Returns town for an outer post code.
public townForOuterPostCode ( string $_code ) : string
$_code string Outer postcode
return string Town name

Property Details

$counties public property

public $counties

$towns public property

public $towns