| 148 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
namespace Faker\Provider\en_SG;
|
|
|
4 |
|
|
|
5 |
class PhoneNumber extends \Faker\Provider\PhoneNumber
|
|
|
6 |
{
|
|
|
7 |
protected static $internationalCodePrefix = [
|
|
|
8 |
'+65',
|
|
|
9 |
'65',
|
|
|
10 |
];
|
|
|
11 |
|
|
|
12 |
protected static $zeroToEight = [0, 1, 2, 3, 4, 5, 6, 7, 8];
|
|
|
13 |
|
|
|
14 |
protected static $oneToEight = [1, 2, 3, 4, 5, 6, 7, 8];
|
|
|
15 |
|
|
|
16 |
protected static $mobileNumberFormats = [
|
|
|
17 |
'{{internationalCodePrefix}}9{{zeroToEight}}## ####',
|
|
|
18 |
'{{internationalCodePrefix}} 9{{zeroToEight}}## ####',
|
|
|
19 |
'9{{zeroToEight}}## ####',
|
|
|
20 |
'{{internationalCodePrefix}}8{{oneToEight}}## ####',
|
|
|
21 |
'{{internationalCodePrefix}} 8{{oneToEight}}## ####',
|
|
|
22 |
'8{{oneToEight}}## ####',
|
|
|
23 |
];
|
|
|
24 |
|
|
|
25 |
protected static $fixedLineNumberFormats = [
|
|
|
26 |
'{{internationalCodePrefix}}6### ####',
|
|
|
27 |
'{{internationalCodePrefix}} 6### ####',
|
|
|
28 |
'6### ####',
|
|
|
29 |
];
|
|
|
30 |
|
|
|
31 |
// http://en.wikipedia.org/wiki/Telephone_numbers_in_Singapore#Numbering_plan
|
|
|
32 |
protected static $formats = [
|
|
|
33 |
'{{mobileNumber}}',
|
|
|
34 |
'{{fixedLineNumber}}',
|
|
|
35 |
];
|
|
|
36 |
|
|
|
37 |
protected static $voipNumber = [
|
|
|
38 |
'{{internationalCodePrefix}}3### ####',
|
|
|
39 |
'{{internationalCodePrefix}} 3### ####',
|
|
|
40 |
'3### ####',
|
|
|
41 |
];
|
|
|
42 |
|
|
|
43 |
protected static $tollFreeInternationalNumber = [
|
|
|
44 |
'800 ### ####',
|
|
|
45 |
];
|
|
|
46 |
|
|
|
47 |
protected static $tollFreeLineNumber = [
|
|
|
48 |
'1800 ### ####',
|
|
|
49 |
];
|
|
|
50 |
|
|
|
51 |
protected static $premiumPhoneNumber = [
|
|
|
52 |
'1900 ### ####',
|
|
|
53 |
];
|
|
|
54 |
|
|
|
55 |
public function tollFreeInternationalNumber()
|
|
|
56 |
{
|
|
|
57 |
return static::numerify(static::randomElement(static::$tollFreeInternationalNumber));
|
|
|
58 |
}
|
|
|
59 |
|
|
|
60 |
public function tollFreeLineNumber()
|
|
|
61 |
{
|
|
|
62 |
return static::numerify(static::randomElement(static::$tollFreeLineNumber));
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
public function premiumPhoneNumber()
|
|
|
66 |
{
|
|
|
67 |
return static::numerify(static::randomElement(static::$premiumPhoneNumber));
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
public function mobileNumber()
|
|
|
71 |
{
|
|
|
72 |
$format = static::randomElement(static::$mobileNumberFormats);
|
|
|
73 |
|
|
|
74 |
return static::numerify($this->generator->parse($format));
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
public function fixedLineNumber()
|
|
|
78 |
{
|
|
|
79 |
$format = static::randomElement(static::$fixedLineNumberFormats);
|
|
|
80 |
|
|
|
81 |
return static::numerify($this->generator->parse($format));
|
|
|
82 |
}
|
|
|
83 |
|
|
|
84 |
public function voipNumber()
|
|
|
85 |
{
|
|
|
86 |
$format = static::randomElement(static::$voipNumber);
|
|
|
87 |
|
|
|
88 |
return static::numerify($this->generator->parse($format));
|
|
|
89 |
}
|
|
|
90 |
|
|
|
91 |
public function internationalCodePrefix()
|
|
|
92 |
{
|
|
|
93 |
return static::randomElement(static::$internationalCodePrefix);
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
public function zeroToEight()
|
|
|
97 |
{
|
|
|
98 |
return static::randomElement(static::$zeroToEight);
|
|
|
99 |
}
|
|
|
100 |
|
|
|
101 |
public function oneToEight()
|
|
|
102 |
{
|
|
|
103 |
return static::randomElement(static::$oneToEight);
|
|
|
104 |
}
|
|
|
105 |
}
|