PhoneNumber.php
94 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Faker\Provider\en_NZ; |
| 4 | |
| 5 | class PhoneNumber extends \Faker\Provider\PhoneNumber |
| 6 | { |
| 7 | /** |
| 8 | * An array of en_NZ landline phone number formats |
| 9 | * @var array |
| 10 | */ |
| 11 | protected static $formats = array( |
| 12 | // National Calls |
| 13 | '{{areaCode}}{{beginningNumber}}######', |
| 14 | '{{areaCode}} {{beginningNumber}}## ####' |
| 15 | ); |
| 16 | |
| 17 | /** |
| 18 | * An array of en_NZ mobile (cell) phone number formats |
| 19 | * @var array |
| 20 | */ |
| 21 | protected static $mobileFormats = array( |
| 22 | // Local |
| 23 | '02########', |
| 24 | '02#########', |
| 25 | '02# ### ####', |
| 26 | '02# #### ####' |
| 27 | ); |
| 28 | |
| 29 | /** |
| 30 | * An array of toll free phone number formats |
| 31 | * @var array |
| 32 | */ |
| 33 | protected static $tollFreeFormats = array( |
| 34 | '0508######', |
| 35 | '0508 ######', |
| 36 | '0508 ### ###', |
| 37 | '0800######', |
| 38 | '0800 ######', |
| 39 | '0800 ### ###', |
| 40 | ); |
| 41 | |
| 42 | /** |
| 43 | * An array of en_NZ landline area codes |
| 44 | * @var array |
| 45 | */ |
| 46 | protected static $areaCodes = array( |
| 47 | '02', '03', '04', '06', '07', '09' |
| 48 | ); |
| 49 | |
| 50 | /** |
| 51 | * An array of en_NZ landline beginning numbers |
| 52 | * @var array |
| 53 | */ |
| 54 | protected static $beginningNumbers = array( |
| 55 | '2', '3', '4', '5', '6', '7', '8', '9' |
| 56 | ); |
| 57 | |
| 58 | /** |
| 59 | * Return a en_NZ mobile phone number |
| 60 | * @return string |
| 61 | */ |
| 62 | public static function mobileNumber() |
| 63 | { |
| 64 | return static::numerify(static::randomElement(static::$mobileFormats)); |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Return a en_NZ toll free phone number |
| 69 | * @return string |
| 70 | */ |
| 71 | public static function tollFreeNumber() |
| 72 | { |
| 73 | return static::numerify(static::randomElement(static::$tollFreeFormats)); |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Return a en_NZ landline area code |
| 78 | * @return string |
| 79 | */ |
| 80 | public static function areaCode() |
| 81 | { |
| 82 | return static::numerify(static::randomElement(static::$areaCodes)); |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Return a en_NZ landline beginning number |
| 87 | * @return string |
| 88 | */ |
| 89 | public static function beginningNumber() |
| 90 | { |
| 91 | return static::numerify(static::randomElement(static::$beginningNumbers)); |
| 92 | } |
| 93 | } |
| 94 |