Address.php
5 years ago
Company.php
5 years ago
Internet.php
5 years ago
Payment.php
5 years ago
Person.php
5 years ago
PhoneNumber.php
5 years ago
PhoneNumber.php
100 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Faker\Provider\fi_FI; |
| 4 | |
| 5 | class PhoneNumber extends \Faker\Provider\PhoneNumber |
| 6 | { |
| 7 | /** |
| 8 | * @link https://www.viestintavirasto.fi/en/internettelephone/numberingoftelecommunicationsnetworks/localcallsandtelecommunicationsareas/mapoftelecommunicationsareas.html |
| 9 | * @var array |
| 10 | */ |
| 11 | protected static $landLineareaCodes = array( |
| 12 | '02', |
| 13 | '03', |
| 14 | '05', |
| 15 | '06', |
| 16 | '08', |
| 17 | '09', |
| 18 | '013', |
| 19 | '014', |
| 20 | '015', |
| 21 | '016', |
| 22 | '017', |
| 23 | '018', |
| 24 | '019', |
| 25 | ); |
| 26 | |
| 27 | /** |
| 28 | * @link https://www.viestintavirasto.fi/en/internettelephone/numberingoftelecommunicationsnetworks/mobilenetworks/mobilenetworkareacodes.html |
| 29 | * @var array |
| 30 | */ |
| 31 | protected static $mobileNetworkAreaCodes = array( |
| 32 | '040', |
| 33 | '050', |
| 34 | '044', |
| 35 | '045', |
| 36 | ); |
| 37 | |
| 38 | protected static $numberFormats = array( |
| 39 | '### ####', |
| 40 | '#######', |
| 41 | ); |
| 42 | |
| 43 | protected static $formats = array( |
| 44 | '+358 ({{ e164MobileNetworkAreaCode }}) {{ numberFormat }}', |
| 45 | '+358 {{ e164MobileNetworkAreaCode }} {{ numberFormat }}', |
| 46 | '+358 ({{ e164landLineAreaCode }}) {{ numberFormat }}', |
| 47 | '+358 {{ e164landLineAreaCode }} {{ numberFormat }}', |
| 48 | '{{ mobileNetworkAreaCode }}{{ separator }}{{ numberFormat }}', |
| 49 | '{{ landLineAreaCode }}{{ separator }}{{ numberFormat }}', |
| 50 | ); |
| 51 | |
| 52 | /** |
| 53 | * @return string |
| 54 | */ |
| 55 | public function landLineAreaCode() |
| 56 | { |
| 57 | return static::randomElement(static::$landLineareaCodes); |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * @return string |
| 62 | */ |
| 63 | public function e164landLineAreaCode() |
| 64 | { |
| 65 | return substr(static::randomElement(static::$landLineareaCodes), 1); |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * @return string |
| 70 | */ |
| 71 | public function mobileNetworkAreaCode() |
| 72 | { |
| 73 | return static::randomElement(static::$mobileNetworkAreaCodes); |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * @return string |
| 78 | */ |
| 79 | public function e164MobileNetworkAreaCode() |
| 80 | { |
| 81 | return substr(static::randomElement(static::$mobileNetworkAreaCodes), 1); |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * @return string |
| 86 | */ |
| 87 | public function numberFormat() |
| 88 | { |
| 89 | return static::randomElement(static::$numberFormats); |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * @return string |
| 94 | */ |
| 95 | public function separator() |
| 96 | { |
| 97 | return static::randomElement(array(' ', '-')); |
| 98 | } |
| 99 | } |
| 100 |