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\it_CH;
4
 
5
class Address extends \Faker\Provider\it_IT\Address
6
{
7
    protected static $buildingNumber = ['%##', '%#', '%', '#a', '#b', '#c'];
8
 
9
    protected static $streetPrefix = ['Piazza', 'Strada', 'Via', 'Borgo', 'Contrada', 'Rotonda', 'Incrocio'];
10
 
11
    protected static $postcode = ['####'];
12
 
13
    /**
14
     * @see https://it.wikipedia.org/wiki/Citt%C3%A0_svizzere
15
     */
16
    protected static $cityNames = [
17
        'Aarau', 'Adliswil', 'Aesch', 'Affoltern am Albis', 'Allschwil', 'Altstätten', 'Amriswil', 'Arbon', 'Arth',
18
        'Baar', 'Baden', 'Basilea', 'Bassersdorf', 'Bellinzona', 'Belp', 'Berna', 'Bienne', 'Binningen', 'Birsfelden', 'Briga-Glis', 'Brugg', 'Buchs', 'Bulle', 'Burgdorf', 'Bülach',
19
        'Carouge', 'Cham', 'Chêne-Bougeries', 'Coira',
20
        'Davos', 'Delémont', 'Dietikon', 'Dübendorf', 'Ebikon',
21
        'Ecublens', 'Einsiedeln', 'Emmen',
22
        'Frauenfeld', 'Freienbach', 'Friburgo',
23
        'Ginevra', 'Gland', 'Gossau', 'Grenchen',
24
        'Herisau', 'Hinwil', 'Horgen', 'Horw',
25
        'Illnau-Effretikon', 'Ittigen',
26
        'Kloten', 'Kreuzlingen', 'Kriens', 'Köniz', 'Küsnacht', 'Küssnacht',
27
        'La Chaux-de-Fonds', 'La Tour-de-Peilz', 'Lancy', 'Langenthal', 'Le Grand-Saconnex', 'Le Locle', 'Liestal', 'Locarno', 'Losanna', 'Lucerna', 'Lugano', 'Lyss',
28
        'Martigny', 'Meilen', 'Mendrisio', 'Meyrin', 'Monthey', 'Montreux', 'Morges', 'Muri bei Bern', 'Muttenz', 'Männedorf', 'Möhlin', 'Münchenstein', 'Münsingen',
29
        'Neuchâtel', 'Neuhausen am Rheinfall', 'Nyon',
30
        'Oberwil', 'Oftringen', 'Olten', 'Onex', 'Opfikon', 'Ostermundigen',
31
        'Pfäffikon', 'Pratteln', 'Prilly', 'Pully',
32
        'Rapperswil-Jona', 'Regensdorf', 'Reinach', 'Renens', 'Rheinfelden', 'Richterswil', 'Riehen', 'Rüti',
33
        'San Gallo', 'Schlieren', 'Sciaffusa', 'Sierre', 'Sion', 'Soletta', 'Spiez', 'Spreitenbach', 'Steffisburg', 'Stäfa', 'Svitto',
34
        'Thalwil', 'Thun', 'Thônex',
35
        'Uster', 'Uzwil',
36
        'Val-de-Travers', 'Vernier', 'Versoix', 'Vevey', 'Veyrier', 'Villars-sur-Glâne', 'Volketswil',
37
        'Wallisellen', 'Weinfelden', 'Wettingen', 'Wetzikon', 'Wil', 'Winterthur', 'Wohlen', 'Worb', 'Wädenswil',
38
        'Yverdon-les-Bains',
39
        'Zofingen', 'Zollikon', 'Zugo', 'Zurigo',
40
    ];
41
 
42
    /**
43
     * @see https://it.wikipedia.org/wiki/Cantoni_della_Svizzera
44
     */
45
    protected static $canton = [
46
        ['AG' => 'Argovia'],
47
        ['AI' => 'Appenzello Interno'],
48
        ['AR' => 'Appenzello Esterno'],
49
        ['BE' => 'Berna'],
50
        ['BL' => 'Basilea Campagna'],
51
        ['BS' => 'Basilea Città'],
52
        ['FR' => 'Friburgo'],
53
        ['GE' => 'Ginevra'],
54
        ['GL' => 'Glarona'],
55
        ['GR' => 'Grigioni'],
56
        ['JU' => 'Giura'],
57
        ['LU' => 'Lucerna'],
58
        ['NE' => 'Neuchâtel'],
59
        ['NW' => 'Nidvaldo'],
60
        ['OW' => 'Obvaldo'],
61
        ['SG' => 'San Gallo'],
62
        ['SH' => 'Sciaffusa'],
63
        ['SO' => 'Soletta'],
64
        ['SZ' => 'Svitto'],
65
        ['TG' => 'Turgovia'],
66
        ['TI' => 'Ticino'],
67
        ['UR' => 'Uri'],
68
        ['VD' => 'Vaud'],
69
        ['VS' => 'Vallese'],
70
        ['ZG' => 'Zugo'],
71
        ['ZH' => 'Zurigo'],
72
    ];
73
 
74
    protected static $cityFormats = [
75
        '{{cityName}}',
76
    ];
77
 
78
    protected static $streetNameFormats = [
79
        '{{streetSuffix}} {{firstName}}',
80
        '{{streetSuffix}} {{lastName}}',
81
    ];
82
 
83
    protected static $streetAddressFormats = [
84
        '{{streetName}} {{buildingNumber}}',
85
    ];
86
    protected static $addressFormats = [
87
        "{{streetAddress}}\n{{postcode}} {{city}}",
88
    ];
89
 
90
    /**
91
     * Returns a random street prefix
92
     *
93
     * @example Via
94
     *
95
     * @return string
96
     */
97
    public static function streetPrefix()
98
    {
99
        return static::randomElement(static::$streetPrefix);
100
    }
101
 
102
    /**
103
     * Returns a random city name.
104
     *
105
     * @example Luzern
106
     *
107
     * @return string
108
     */
109
    public function cityName()
110
    {
111
        return static::randomElement(static::$cityNames);
112
    }
113
 
114
    /**
115
     * Returns a canton
116
     *
117
     * @example array('BE' => 'Bern')
118
     *
119
     * @return array
120
     */
121
    public static function canton()
122
    {
123
        return static::randomElement(static::$canton);
124
    }
125
 
126
    /**
127
     * Returns the abbreviation of a canton.
128
     *
129
     * @return string
130
     */
131
    public static function cantonShort()
132
    {
133
        $canton = static::canton();
134
 
135
        return key($canton);
136
    }
137
 
138
    /**
139
     * Returns the name of canton.
140
     *
141
     * @return string
142
     */
143
    public static function cantonName()
144
    {
145
        $canton = static::canton();
146
 
147
        return current($canton);
148
    }
149
}