Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Faker\Provider;
4
 
5
use Faker\Calculator\Luhn;
6
 
7
class PhoneNumber extends Base
8
{
9
    protected static $formats = ['###-###-###'];
10
 
11
    /**
12
     * @see https://github.com/giggsey/libphonenumber-for-php/blob/master/src/CountryCodeToRegionCodeMap.php
13
     * @see https://libphonenumber.appspot.com/phonenumberparser?number=%2B4576597442
14
     */
15
    protected static $e164Formats = [
16
        '+1##########',
17
        '+7##########',
18
        '+20##########',
19
        '+27##########',
20
        '+30##########',
21
        '+31##########',
22
        '+32#########',
23
        '+33#########',
24
        '+34#########',
25
        '+36#########',
26
        '+39##########',
27
        '+40#########',
28
        '+41#########',
29
        '+43##########',
30
        '+44##########',
31
        '+45########',
32
        '+46##########',
33
        '+47########',
34
        '+48##########',
35
        '+49##########',
36
        '+51#########',
37
        '+52##########',
38
        '+53##########',
39
        '+54##########',
40
        '+55#########',
41
        '+56##########',
42
        '+57##########',
43
        '+58##########',
44
        '+60##########',
45
        '+61##########',
46
        '+62##########',
47
        '+63##########',
48
        '+64##########',
49
        '+65##########',
50
        '+66##########',
51
        '+81##########',
52
        '+82##########',
53
        '+84##########',
54
        '+86##########',
55
        '+90##########',
56
        '+91##########',
57
        '+92##########',
58
        '+93#########',
59
        '+94#########',
60
        '+95##########',
61
        '+98##########',
62
        '+211#########',
63
        '+212#########',
64
        '+213#########',
65
        '+216########',
66
        '+218#########',
67
        '+220#######',
68
        '+221#########',
69
        '+222########',
70
        '+223########',
71
        '+224#########',
72
        '+225##########',
73
        '+226########',
74
        '+227########',
75
        '+228########',
76
        '+229########',
77
        '+230########',
78
        '+231#########',
79
        '+232########',
80
        '+233#########',
81
        '+234##########',
82
        '+235########',
83
        '+236########',
84
        '+237#########',
85
        '+238#######',
86
        '+239#######',
87
        '+240#########',
88
        '+241########',
89
        '+242#########',
90
        '+243#########',
91
        '+244#########',
92
        '+245#########',
93
        '+246#######',
94
        '+247######',
95
        '+248#######',
96
        '+249#########',
97
        '+250#########',
98
        '+251#########',
99
        '+252#########',
100
        '+253########',
101
        '+254##########',
102
        '+255#########',
103
        '+256#########',
104
        '+257########',
105
        '+258#########',
106
        '+260#########',
107
        '+261#########',
108
        '+262#########',
109
        '+263##########',
110
        '+264#########',
111
        '+265#########',
112
        '+266########',
113
        '+267##########',
114
        '+268#########',
115
        '+269#######',
116
        '+290#####',
117
        '+291#######',
118
        '+297#######',
119
        '+298######',
120
        '+299######',
121
        '+350########',
122
        '+351#########',
123
        '+352##########',
124
        '+353##########',
125
        '+354#########',
126
        '+355#########',
127
        '+356########',
128
        '+357########',
129
        '+358##########',
130
        '+359#########',
131
        '+370########',
132
        '+371########',
133
        '+372##########',
134
        '+373########',
135
        '+374########',
136
        '+375##########',
137
        '+376#########',
138
        '+377#########',
139
        '+378##########',
140
        '+380##########',
141
        '+381##########',
142
        '+382#########',
143
        '+383#########',
144
        '+385#########',
145
        '+386########',
146
        '+387#########',
147
        '+389########',
148
        '+420#########',
149
        '+421#########',
150
        '+423#########',
151
        '+500#####',
152
        '+501#######',
153
        '+502########',
154
        '+503########',
155
        '+504########',
156
        '+505########',
157
        '+506########',
158
        '+507##########',
159
        '+508#########',
160
        '+509########',
161
        '+590#########',
162
        '+591#########',
163
        '+592#######',
164
        '+593##########',
165
        '+594#########',
166
        '+595##########',
167
        '+596#########',
168
        '+597#######',
169
        '+598##########',
170
        '+599########',
171
        '+670########',
172
        '+672######',
173
        '+673#######',
174
        '+674#######',
175
        '+675########',
176
        '+676#######',
177
        '+677#######',
178
        '+678#######',
179
        '+679#######',
180
        '+680#######',
181
        '+681#########',
182
        '+682#####',
183
        '+683#######',
184
        '+685##########',
185
        '+686########',
186
        '+687######',
187
        '+688#######',
188
        '+689#########',
189
        '+690#######',
190
        '+691#######',
191
        '+692#######',
192
        '+800########',
193
        '+808########',
194
        '+850##########',
195
        '+852#########',
196
        '+853########',
197
        '+855##########',
198
        '+856##########',
199
        '+870#########',
200
        '+878############',
201
        '+880##########',
202
        '+881#########',
203
        '+882##########',
204
        '+883#########',
205
        '+886##########',
206
        '+888###########',
207
        '+960##########',
208
        '+961########',
209
        '+962#########',
210
        '+963#########',
211
        '+964##########',
212
        '+965########',
213
        '+966##########',
214
        '+967#########',
215
        '+968#########',
216
        '+970##########',
217
        '+971##########',
218
        '+972##########',
219
        '+973########',
220
        '+974########',
221
        '+975########',
222
        '+976##########',
223
        '+977##########',
224
        '+979#########',
225
        '+992#########',
226
        '+993########',
227
        '+994#########',
228
        '+995#########',
229
        '+996#########',
230
        '+998#########',
231
    ];
232
 
233
    /**
234
     * @example '555-123-546'
235
     *
236
     * @return string
237
     */
238
    public function phoneNumber()
239
    {
240
        return static::numerify($this->generator->parse(static::randomElement(static::$formats)));
241
    }
242
 
243
    /**
244
     * @example +11134567890
245
     *
246
     * @return string
247
     */
248
    public function e164PhoneNumber()
249
    {
250
        return static::numerify($this->generator->parse(static::randomElement(static::$e164Formats)));
251
    }
252
 
253
    /**
254
     * International Mobile Equipment Identity (IMEI)
255
     *
256
     * @see http://en.wikipedia.org/wiki/International_Mobile_Station_Equipment_Identity
257
     * @see http://imei-number.com/imei-validation-check/
258
     *
259
     * @example '720084494799532'
260
     *
261
     * @return int $imei
262
     */
263
    public function imei()
264
    {
265
        $imei = (string) static::numerify('##############');
266
        $imei .= Luhn::computeCheckDigit($imei);
267
 
268
        return $imei;
269
    }
270
}