Documentation

LocaleInfoMLT extends LocaleInfoEurozone
in package

Locale info for Malta; see {@see LocaleInfo}

Table of Contents

Properties

$auto  : mixed
$currency_decimal  : mixed
$currency_iso  : mixed
$currency_name  : mixed
$currency_symbol  : mixed
$decimal_seperator  : mixed
$group_seperator  : mixed
$line1  : mixed
$line2  : mixed
$longdate  : mixed
$phone_code  : mixed
$postcode_name  : mixed
$shortdate  : mixed
$state_list  : mixed
$state_name  : mixed
$time  : mixed
$town_name  : mixed

Methods

auto()  : LocaleInfo
Automatically chooses a locale and returns it
get()  : LocaleInfo
Returns the LocaleInfo class for the specified country code.
getCurrencyISO()  : string
Return currency ISO code, eg 'AUD'
getCurrencyName()  : string
The name of the currency, e.g. 'Dollar' for $
getParameters()  : mixed
Return the raw parameters of this locale
getPhoneCode()  : string
Return phone code, eg '213'
getStateList()  : array<string|int, mixed>
Gets a list of states
getStateName()  : string
Get the name of a given state by looking it up in the states list
longdate()  : string
Formats dates in a long format
moneyFormat()  : string
Formats currency values, similar to the interal {@see number_format} function
nonNumericStates()  : array<string|int, mixed>
Organises the state list so that it doesn't have numeric keys.
numberFormat()  : string
Formats numbers, like the interal {@see number_format} function
outputAddressField()  : string
Generates a single address field for the current locale
outputAddressFields()  : string
Generates the address fields for the current locale
outputAddressText()  : string
Returns a string which is a formatted version of the address specified using the provided data.
shortdate()  : string
Formats dates in a short format
stateValues()  : array<string|int, mixed>
Extracts only the enterable values from the state list
time()  : string
Formats times
validateAddress()  : void
Validate address fields

Properties

$currency_decimal

protected mixed $currency_decimal = 2

$longdate

protected mixed $longdate = 'D jS M Y'

$postcode_name

protected mixed $postcode_name = 'Postcode'

$state_list

protected mixed $state_list = ['Attard', 'Balzan', 'Birgu', 'Birkirkara', 'Birżebbuġa', 'Bormla', 'Dingli', 'Fgura', 'Floriana', 'Fontana', 'Gudja', 'Gżira', 'Għajnsielem', 'Għarb', 'Għargħur', 'Għasri', 'Għaxaq', 'Ħamrun', 'Iklin', 'Isla', 'Kalkara', 'Kerċem', 'Kirkop', 'Lija', 'Luqa', 'Marsa', 'Marsaskala', 'Marsaxlokk', 'Mdina', 'Mellieħa', 'Mġarr', 'Mosta', 'Mqabba', 'Msida', 'Mtarfa', 'Munxar', 'Nadur', 'Naxxar', 'Paola', 'Pembroke', 'Pietà', 'Qala', 'Qormi', 'Qrendi', 'Rabat Gozo', 'Rabat Malta', 'Safi', 'Saint Julian\'s', 'Saint John', 'Saint Lawrence', 'Saint Paul\'s Bay', 'Sannat', 'Saint Lucia\'s', 'Santa Venera', 'Siġġiewi', 'Sliema', 'Swieqi', 'Ta\' Xbiex', 'Tarxien', 'Valletta', 'Xagħra', 'Xewkija', 'Xgħajra', 'Żabbar', 'Żebbuġ Gozo', 'Żebbuġ Malta', 'Żejtun', 'Żurrieq']

$state_name

protected mixed $state_name = 'State/Province'

$town_name

protected mixed $town_name = 'Suburb/Town'

Methods

get()

Returns the LocaleInfo class for the specified country code.

public static get([string $code = null ]) : LocaleInfo

If no LocaleInfo can be found, a generic version is used.

Parameters
$code : string = null

3-letter country code (ISO 3166-1 alpha-3)

Return values
LocaleInfo

getCurrencyISO()

Return currency ISO code, eg 'AUD'

public getCurrencyISO() : string
Return values
string —

eg 'AUD'

getCurrencyName()

The name of the currency, e.g. 'Dollar' for $

public getCurrencyName() : string
Return values
string

getParameters()

Return the raw parameters of this locale

public getParameters() : mixed

getPhoneCode()

Return phone code, eg '213'

public getPhoneCode() : string
Return values
string —

eg '213'

getStateList()

Gets a list of states

public getStateList() : array<string|int, mixed>
Return values
array<string|int, mixed> —

For use with Fb::dropdown

getStateName()

Get the name of a given state by looking it up in the states list

public getStateName(string $val) : string
Parameters
$val : string

Values stored by the LocaleInfo::outputAddressFields dropdown field

Return values
string —

Full name of state, e.g. 'South Australia'

longdate()

Formats dates in a long format

public longdate(int $timestamp) : string
Parameters
$timestamp : int

Unix timestamp

Return values
string

moneyFormat()

Formats currency values, similar to the interal {@see number_format} function

public moneyFormat(int|float $number[, int $precision = null ]) : string
Parameters
$number : int|float

The number to format

$precision : int = null

The number of decimal places to render; if NULL then it's locale-dependent

Return values
string

nonNumericStates()

Organises the state list so that it doesn't have numeric keys.

public nonNumericStates() : array<string|int, mixed>

The state names become the form field values if state list is a numeric array. This makes it easy to configure a new locate with states/provinces/etc which don't have standard abbreviations.

E.g. ['State 1', 'State 2'] would become: ['State 1' => 'State 1', 'State 2' => 'State 2']

Return values
array<string|int, mixed>

numberFormat()

Formats numbers, like the interal {@see number_format} function

public numberFormat(int|float $number[, int $precision = 0 ]) : string
Parameters
$number : int|float

The number to format

$precision : int = 0

The number of decimal places to render

Return values
string

outputAddressField()

Generates a single address field for the current locale

public outputAddressField(string $field[, string $prefix = '' ][, bool $required = false ]) : string
Parameters
$field : string

'street', 'street2', 'town', 'state', or 'postcode'

$prefix : string = ''

Optional prefix, e.g. 'postal_'

$required : bool = false

True if the address as a whole is required, irrespective of the individual field

Return values
string

outputAddressFields()

Generates the address fields for the current locale

public outputAddressFields([string $prefix = '' ][, bool $required = false ]) : string
Parameters
$prefix : string = ''

Optional prefix, e.g. 'postal_'

$required : bool = false

True if the address as a whole is required, irrespective of individual fields

Return values
string

outputAddressText()

Returns a string which is a formatted version of the address specified using the provided data.

public outputAddressText(array<string|int, mixed>|object $data) : string

The string contains newlines which will need converting to BRs for HTML output

Parameters
$data : array<string|int, mixed>|object

A record from the database required columns: street, town, state, postcode, country

Return values
string —

Plaintext

shortdate()

Formats dates in a short format

public shortdate(int $timestamp) : string
Parameters
$timestamp : int

Unix timestamp

Return values
string

stateValues()

Extracts only the enterable values from the state list

public stateValues() : array<string|int, mixed>

This should be used for validation.

Return values
array<string|int, mixed>

time()

Formats times

public time(int $timestamp) : string
Parameters
$timestamp : int

Unix timestamp

Return values
string

validateAddress()

Validate address fields

public validateAddress(Validator $valid[, bool $required = false ]) : void
Parameters
$valid : Validator

Validator for the form being processed

$required : bool = false

Are the address fields required?

On this page

Search results