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\vi_VN;
4
 
5
class PhoneNumber extends \Faker\Provider\PhoneNumber
6
{
7
    protected static $areaCodes = [
8
        76, 281, 64, 781, 240, 241,
9
        75, 650, 56, 651, 62, 780,
10
        26, 710, 511, 500, 510, 230,
11
        61, 67, 59, 219, 351, 4,
12
        39, 320, 31, 711, 218, 321,
13
        8, 58, 77, 60, 231, 25,
14
        20, 63, 72, 350, 38, 30,
15
        68, 210, 57, 52, 510, 55,
16
        33, 53, 79, 22, 66, 36,
17
        280, 37, 54, 73, 74, 27,
18
        70, 211, 29,
19
        // Mobile
20
        96, 97, 98, 162, 163, 164, 165, 166, 167, 168, 169, // Viettel
21
        91, 94, 123, 124, 125, 127, 129, // Vinaphone
22
        90, 93, 120, 121, 122, 126, 128, // Mobifone
23
        92, 186, 188, // Vietnamobile
24
        99, 199, // Gmobile
25
        95, // Sfone
26
    ];
27
 
28
    protected static $formats = [
29
        '7' => [
30
            '0[a] ### ####',
31
            '(0[a]) ### ####',
32
            '0[a]-###-####',
33
            '(0[a])###-####',
34
            '84-[a]-###-####',
35
            '(84)([a])###-####',
36
            '+84-[a]-###-####',
37
        ],
38
        '8' => [
39
            '0[a] #### ####',
40
            '(0[a]) #### ####',
41
            '0[a]-####-####',
42
            '(0[a])####-####',
43
            '84-[a]-####-####',
44
            '(84)([a])####-####',
45
            '+84-[a]-####-####',
46
        ],
47
    ];
48
 
49
    public function phoneNumber()
50
    {
51
        $areaCode = static::randomElement(static::$areaCodes);
52
        $areaCodeLength = strlen($areaCode);
53
        $digits = 7;
54
 
55
        if ($areaCodeLength < 2) {
56
            $digits = 8;
57
        }
58
 
59
        return static::numerify(str_replace('[a]', $areaCode, static::randomElement(static::$formats[$digits])));
60
    }
61
}