mirror of
https://github.com/fzaninotto/Faker.git
synced 2025-03-20 23:39:51 +01:00
Merge pull request #164 from rcuddy/rcuddy_create_enAU_providers
Create en_AU provider for Address,Internet,PhoneNumber
This commit is contained in:
commit
29f203c407
59
src/Faker/Provider/en_AU/Address.php
Normal file
59
src/Faker/Provider/en_AU/Address.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Faker\Provider\en_AU;
|
||||
|
||||
/**
|
||||
* Class Address
|
||||
* @see http://www.ipaustralia.gov.au/about-us/corporate/address-standards/
|
||||
* @package Faker\Provider\en_AU
|
||||
*/
|
||||
class Address extends \Faker\Provider\en_US\Address
|
||||
{
|
||||
protected static $cityPrefix = array('North', 'East', 'West', 'South', 'New', 'Lake', 'Port', 'St.');
|
||||
|
||||
protected static $buildingNumber = array('###', '##', '#');
|
||||
|
||||
protected static $buildingLetters = array('A','B','C','D');
|
||||
|
||||
protected static $streetSuffix = array(
|
||||
'Access', 'Alley', 'Alleyway', 'Amble', 'Anchorage', 'Approach', 'Arcade', 'Artery', 'Avenue', 'Basin', 'Beach', 'Bend', 'Block', 'Boulevard', 'Brace', 'Brae', 'Break', 'Bridge', 'Broadway', 'Brow', 'Bypass', 'Byway', 'Causeway', 'Centre', 'Centreway', 'Chase', 'Circle', 'Circlet', 'Circuit', 'Circus', 'Close', 'Colonnade', 'Common', 'Concourse', 'Copse', 'Corner', 'Corso', 'Court', 'Courtyard', 'Cove', 'Crescent', 'Crest', 'Cross', 'Crossing', 'Crossroad', 'Crossway', 'Cruiseway', 'Cul-de-sac', 'Cutting', 'Dale', 'Dell', 'Deviation', 'Dip', 'Distributor', 'Drive', 'Driveway', 'Edge', 'Elbow', 'End', 'Entrance', 'Esplanade', 'Estate', 'Expressway', 'Extension', 'Fairway', 'Fire Track', 'Firetrail', 'Flat', 'Follow', 'Footway', 'Foreshore', 'Formation', 'Freeway', 'Front', 'Frontage', 'Gap', 'Garden', 'Gardens', 'Gate', 'Gates', 'Glade', 'Glen', 'Grange', 'Green', 'Ground', 'Grove', 'Gully', 'Heights', 'Highroad', 'Highway', 'Hill', 'Interchange', 'Intersection', 'Junction', 'Key', 'Landing', 'Lane', 'Laneway', 'Lees', 'Line', 'Link', 'Little', 'Lookout', 'Loop', 'Lower', 'Mall', 'Meander', 'Mew', 'Mews', 'Motorway', 'Mount', 'Nook', 'Outlook', 'Parade', 'Park', 'Parklands', 'Parkway', 'Part', 'Pass', 'Path', 'Pathway', 'Piazza', 'Place', 'Plateau', 'Plaza', 'Pocket', 'Point', 'Port', 'Promenade', 'Quad', 'Quadrangle', 'Quadrant', 'Quay', 'Quays', 'Ramble', 'Ramp', 'Range', 'Reach', 'Reserve', 'Rest', 'Retreat', 'Ride', 'Ridge', 'Ridgeway', 'Right Of Way', 'Ring', 'Rise', 'River', 'Riverway', 'Riviera', 'Road', 'Roads', 'Roadside', 'Roadway', 'Ronde', 'Rosebowl', 'Rotary', 'Round', 'Route', 'Row', 'Rue', 'Run', 'Service Way', 'Siding', 'Slope', 'Sound', 'Spur', 'Square', 'Stairs', 'State Highway', 'Steps', 'Strand', 'Street', 'Strip', 'Subway', 'Tarn', 'Terrace', 'Thoroughfare', 'Tollway', 'Top', 'Tor', 'Towers', 'Track', 'Trail', 'Trailer', 'Triangle', 'Trunkway', 'Turn', 'Underpass', 'Upper', 'Vale', 'Viaduct', 'View', 'Villas', 'Vista', 'Wade', 'Walk', 'Walkway', 'Way', 'Wynd'
|
||||
);
|
||||
|
||||
protected static $postcode = array('####');
|
||||
|
||||
protected static $state = array(
|
||||
'Australian Capital Territory', 'New South Wales', 'Northern Territory', 'Queensland', 'South Australia', 'Tasmania', 'Victoria'
|
||||
);
|
||||
|
||||
protected static $stateAbbr = array(
|
||||
'ACT', 'NSW', 'NT', 'QLD', 'SA', 'TAS', 'VIC'
|
||||
);
|
||||
|
||||
protected static $streetAddressFormats = array(
|
||||
'{{buildingNumber}} {{streetName}}',
|
||||
'{{buildingNumber}}{{buildingLetter}} {{streetName}}',
|
||||
'{{secondaryAddress}} {{buildingNumber}} {{streetName}}',
|
||||
);
|
||||
|
||||
protected static $secondaryAddressFormats = array(
|
||||
'Apt. ###',
|
||||
'Flat ##',
|
||||
'Suite ###',
|
||||
'Unit ##',
|
||||
'Level #',
|
||||
'### /',
|
||||
'## /',
|
||||
'# /',
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns a sane building letter
|
||||
* @example B
|
||||
*/
|
||||
public static function buildingLetter()
|
||||
{
|
||||
return static::toUpper(static::randomElement(static::$buildingLetters));
|
||||
}
|
||||
|
||||
|
||||
}
|
9
src/Faker/Provider/en_AU/Internet.php
Normal file
9
src/Faker/Provider/en_AU/Internet.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Faker\Provider\en_AU;
|
||||
|
||||
class Internet extends \Faker\Provider\Internet
|
||||
{
|
||||
protected static $freeEmailDomain = array('gmail.com', 'yahoo.com', 'hotmail.com', 'gmail.com.au', 'yahoo.com.au', 'hotmail.com.au');
|
||||
protected static $tld = array('com', 'com.au', 'org', 'org.au', 'net', 'net.au', 'biz', 'info', 'edu', 'edu.au');
|
||||
}
|
66
src/Faker/Provider/en_AU/PhoneNumber.php
Normal file
66
src/Faker/Provider/en_AU/PhoneNumber.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace Faker\Provider\en_AU;
|
||||
|
||||
use Faker\Generator;
|
||||
|
||||
class PhoneNumber extends \Faker\Provider\PhoneNumber
|
||||
{
|
||||
protected static $formats = array(
|
||||
// Local calls
|
||||
'#### ####',
|
||||
'####-####',
|
||||
'####.####',
|
||||
'########',
|
||||
|
||||
// National dialing
|
||||
'0{{areaCode}} #### ####',
|
||||
'0{{areaCode}}-####-####',
|
||||
'0{{areaCode}}.####.####',
|
||||
'0{{areaCode}}########',
|
||||
|
||||
// Optional parenthesis
|
||||
'(0{{areaCode}}) #### ####',
|
||||
'(0{{areaCode}})-####-####',
|
||||
'(0{{areaCode}}).####.####',
|
||||
'(0{{areaCode}})########',
|
||||
|
||||
// International drops the 0
|
||||
'+61 {{areaCode}} #### ####',
|
||||
'+61-{{areaCode}}-####-####',
|
||||
'+61.{{areaCode}}.####.####',
|
||||
'+61{{areaCode}}########',
|
||||
);
|
||||
|
||||
// 04 Mobile telephones (Australia-wide) mostly commonly written 4 - 3 - 3 instead of 2 - 4 - 4
|
||||
protected static $mobileFormats = array(
|
||||
'04## ### ###',
|
||||
'04##-###-###',
|
||||
'04##.###.###',
|
||||
'+61 4## ### ###',
|
||||
'+61-4##-###-###',
|
||||
'+61.4##.###.###',
|
||||
);
|
||||
|
||||
protected static $areacodes = array(
|
||||
'2', '3', '7', '8'
|
||||
);
|
||||
|
||||
public static function phoneNumber()
|
||||
{
|
||||
$format = static::numerify(static::randomElement(static::$formats));
|
||||
return str_replace('{{areaCode}}', static::areaCode(), $format);
|
||||
}
|
||||
|
||||
public static function mobileNumber()
|
||||
{
|
||||
return static::numerify(static::randomElement(static::$mobileFormats));
|
||||
}
|
||||
|
||||
public static function areaCode()
|
||||
{
|
||||
return static::numerify(static::randomElement(static::$areacodes));
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user