\cge_address

A simple class for defining and manipulating an address.

Summary

Methods
Properties
Constants
jsonSerialize()
__get()
__set()
set_company()
get_company()
set_firstname()
get_firstname()
set_lastname()
get_lastname()
set_address1()
get_address1()
set_address2()
get_address2()
set_city()
get_city()
set_state()
get_state()
set_postal()
get_postal()
set_country()
get_country()
set_phone()
get_phone()
set_fax()
get_fax()
set_email()
get_email()
is_valid()
from_array()
to_array()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

jsonSerialize()

jsonSerialize()

__get()

__get( $key)

Parameters

$key

__set()

__set( $key,  $val)

Parameters

$key
$val

set_company()

set_company(string $str)

Set the company name for this address.

Parameters

string $str

get_company()

get_company() : string

Return the company name (if any) associated with this address.

Returns

string

set_firstname()

set_firstname(string $str)

Set the first name for this address.

Parameters

string $str

get_firstname()

get_firstname() : string

Return the first name (if any) associated with this address.

Returns

string

set_lastname()

set_lastname(string $str)

Set the last name for this address.

Parameters

string $str

get_lastname()

get_lastname() : string

Return the last name (if any) associated with this address.

Returns

string

set_address1()

set_address1(string $str)

Set the first address line for this address.

Parameters

string $str

get_address1()

get_address1() : string

Return the first address line (if any) associated with this address.

Returns

string

set_address2()

set_address2(string $str)

Set the second address line for this address.

Parameters

string $str

get_address2()

get_address2() : string

Return the second address line (if any) associated with this address.

Returns

string

set_city()

set_city(string $str)

Set the city for this address.

Parameters

string $str

get_city()

get_city() : string

Return the city (if any) associated with this address.

Returns

string

set_state()

set_state(string $str)

Set the state for this address.

Parameters

string $str

get_state()

get_state() : string

Return the state (if any) associated with this address.

Returns

string

set_postal()

set_postal(string $str)

Set the postal/zip code for this address.

Parameters

string $str

get_postal()

get_postal() : string

Return the postal/zip code (if any) associated with this address.

Returns

string

set_country()

set_country(string $str)

Set the country for this address.

it is recommended to use the short country code (i.e: US or CA) for most addresses.

Parameters

string $str

get_country()

get_country() : string

Return the country (if any) associated with this address.

Returns

string

set_phone()

set_phone(string $str)

Set a phone number for this address.

Parameters

string $str

get_phone()

get_phone() : string

Return the phone number (if any) associated with this address.

Returns

string

set_fax()

set_fax(string $str)

Set a fax number for this address.

Parameters

string $str

get_fax()

get_fax() : string

Return the fax number (if any) associated with this address.

Returns

string

set_email()

set_email(string $str)

Set an email address for this address.

Parameters

string $str

get_email()

get_email() : string

Return the email address (if any) associated with this address.

Returns

string

is_valid()

is_valid() : bool

Test if the address is valid or not.

Returns

bool

from_array()

from_array(array $params, string $prefix)

Fill the contents of the current object with the data from an array.

Expects an associative array with the following fields: company,firstname,lastname,address1,address2,city,state,postal,country,phone,fax,email.

Parameters

array $params

The input array

string $prefix

An optional prefix for the array keys.

to_array()

to_array(string $prefix) : array

Create an associative array with the details oft he address.

Parameters

string $prefix

An optional prefix for each of the array keys.

Returns

array