PhoneNumber.php
57 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Faker\Provider\en_AU; |
| 4 | |
| 5 | class PhoneNumber extends \Faker\Provider\PhoneNumber |
| 6 | { |
| 7 | protected static $formats = array( |
| 8 | // Local calls |
| 9 | '#### ####', |
| 10 | '####-####', |
| 11 | '####.####', |
| 12 | '########', |
| 13 | |
| 14 | // National dialing |
| 15 | '0{{areaCode}} #### ####', |
| 16 | '0{{areaCode}}-####-####', |
| 17 | '0{{areaCode}}.####.####', |
| 18 | '0{{areaCode}}########', |
| 19 | |
| 20 | // Optional parenthesis |
| 21 | '(0{{areaCode}}) #### ####', |
| 22 | '(0{{areaCode}})-####-####', |
| 23 | '(0{{areaCode}}).####.####', |
| 24 | '(0{{areaCode}})########', |
| 25 | |
| 26 | // International drops the 0 |
| 27 | '+61 {{areaCode}} #### ####', |
| 28 | '+61-{{areaCode}}-####-####', |
| 29 | '+61.{{areaCode}}.####.####', |
| 30 | '+61{{areaCode}}########', |
| 31 | ); |
| 32 | |
| 33 | // 04 Mobile telephones (Australia-wide) mostly commonly written 4 - 3 - 3 instead of 2 - 4 - 4 |
| 34 | protected static $mobileFormats = array( |
| 35 | '04## ### ###', |
| 36 | '04##-###-###', |
| 37 | '04##.###.###', |
| 38 | '+61 4## ### ###', |
| 39 | '+61-4##-###-###', |
| 40 | '+61.4##.###.###', |
| 41 | ); |
| 42 | |
| 43 | protected static $areacodes = array( |
| 44 | '2', '3', '7', '8' |
| 45 | ); |
| 46 | |
| 47 | public static function mobileNumber() |
| 48 | { |
| 49 | return static::numerify(static::randomElement(static::$mobileFormats)); |
| 50 | } |
| 51 | |
| 52 | public static function areaCode() |
| 53 | { |
| 54 | return static::numerify(static::randomElement(static::$areacodes)); |
| 55 | } |
| 56 | } |
| 57 |