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\fr_CH;
4
 
5
class Address extends \Faker\Provider\fr_FR\Address
6
{
7
    protected static $buildingNumber = ['%##', '%#', '%', '#a', '#b', '#c'];
8
 
9
    protected static $streetPrefix = ['Rue', 'Rue', 'Chemin', 'Avenue', 'Boulevard', 'Place', 'Impasse'];
10
 
11
    protected static $postcode = ['####'];
12
 
13
    /**
14
     * @see https://fr.wikipedia.org/wiki/Villes_de_Suisse
15
     */
16
    protected static $cityNames = [
17
        'Aarau', 'Aarberg', 'Aarburg', 'Agno', 'Aigle VD', 'Altdorf', 'Altstätten', 'Appenzell', 'Arbon', 'Ascona', 'Aubonne', 'Avenches',
18
        'Baden', 'Bad Zurzach', 'Bâle', 'Bellinzone', 'Berne', 'Beromünster', 'Berthoud', 'Biasca', 'Bienne', 'Bischofszell', 'Boudry', 'Bourg-Saint-Pierre', 'Bremgarten AG', 'Brigue', 'Brugg', 'Bulle', 'Bülach',
19
        'Cerlier', 'Châtel-Saint-Denis',
20
        'Coire', 'Conthey', 'Coppet', 'Cossonay', 'Croglio', 'Cudrefin', 'Cully',
21
        'Delémont', 'Diessenhofen', 'Échallens', 'Eglisau', 'Elgg', 'Estavayer-le-Lac',
22
        'Frauenfeld', 'Fribourg',
23
        'Genève', 'Glaris', 'Gordola', 'Grandcour', 'Grandson', 'Greifensee', 'Grüningen', 'Gruyères',
24
        'Hermance', 'Huttwil',
25
        'Ilanz',
26
        'Kaiserstuhl', 'Klingnau',
27
        'La Chaux-de-Fonds', 'La Neuveville', 'La Sarraz', 'La Tour-de-Peilz', 'La Tour-de-Trême', 'Le Landeron', 'Les Clées', 'Lachen', 'Langenthal', 'Laufon', 'Laufenburg', 'Laupen', 'Lausanne', 'Lenzburg', 'Loèche', 'Lichtensteig', 'Liestal', 'Locarno', 'Losone', 'Lugano', 'Lutry', 'Lucerne',
28
        'Maienfeld', 'Martigny', 'Mellingen', 'Mendrisio', 'Monthey', 'Morat', 'Morcote', 'Morges', 'Moudon', 'Moutier', 'Münchenstein',
29
        'Neuchâtel', 'Neunkirch', 'Nidau', 'Nyon',
30
        'Olten', 'Orbe', 'Orsières',
31
        'Payerne', 'Porrentruy',
32
        'Rapperswil', 'Regensberg', 'Rheinau', 'Rheineck', 'Rheinfelden', 'Riva San Vitale', 'Rolle', 'Romainmôtier', 'Romont FR', 'Rorschach', 'Rue',
33
        'Saillon', 'Saint-Maurice', 'Saint-Prex', 'Saint-Ursanne', 'Sala', 'Saint-Gall', 'Sargans', 'Sarnen', 'Schaffhouse', 'Schwytz', 'Sembrancher', 'Sempach', 'Sion', 'Soleure', 'Splügen', 'Stans', 'Steckborn', 'Stein am Rhein', 'Sursee',
34
        'Thoune', 'Thusis',
35
        'Unterseen', 'Uznach',
36
        'Valangin', 'Vevey', 'Villeneuve', 'Viège',
37
        'Waldenburg', 'Walenstadt', 'Wangen an der Aare', 'Werdenberg', 'Wiedlisbach', 'Wil', 'Willisau', 'Winterthour',
38
        'Yverdon-les-Bains',
39
        'Zofingue', 'Zoug', 'Zurich',
40
    ];
41
 
42
    /**
43
     * @see https://fr.wikipedia.org/wiki/Canton_suisse
44
     */
45
    protected static $canton = [
46
        ['AG' => 'Argovie'],
47
        ['AI' => 'Appenzell Rhodes-Intérieures'],
48
        ['AR' => 'Appenzell Rhodes-Extérieures'],
49
        ['BE' => 'Berne'],
50
        ['BL' => 'Bâle-Campagne'],
51
        ['BS' => 'Bâle-Ville'],
52
        ['FR' => 'Fribourg'],
53
        ['GE' => 'Genève'],
54
        ['GL' => 'Glaris'],
55
        ['GR' => 'Grisons'],
56
        ['JU' => 'Jura'],
57
        ['LU' => 'Lucerne'],
58
        ['NE' => 'Neuchâtel'],
59
        ['NW' => 'Nidwald'],
60
        ['OW' => 'Obwald'],
61
        ['SG' => 'Saint-Gall'],
62
        ['SH' => 'Schaffhouse'],
63
        ['SO' => 'Soleure'],
64
        ['SZ' => 'Schwytz'],
65
        ['TG' => 'Thurgovie'],
66
        ['TI' => 'Tessin'],
67
        ['UR' => 'Uri'],
68
        ['VD' => 'Vaud'],
69
        ['VS' => 'Valais'],
70
        ['ZG' => 'Zoug'],
71
        ['ZH' => 'Zurich'],
72
    ];
73
 
74
    protected static $cityFormats = [
75
        '{{cityName}}',
76
    ];
77
 
78
    protected static $streetNameFormats = [
79
        '{{streetPrefix}} {{lastName}}',
80
        '{{streetPrefix}} de {{cityName}}',
81
        '{{streetPrefix}} de {{lastName}}',
82
    ];
83
 
84
    protected static $streetAddressFormats = [
85
        '{{streetName}} {{buildingNumber}}',
86
    ];
87
    protected static $addressFormats = [
88
        "{{streetAddress}}\n{{postcode}} {{city}}",
89
    ];
90
 
91
    /**
92
     * Returns a random street prefix
93
     *
94
     * @example Rue
95
     *
96
     * @return string
97
     */
98
    public static function streetPrefix()
99
    {
100
        return static::randomElement(static::$streetPrefix);
101
    }
102
 
103
    /**
104
     * Returns a random city name.
105
     *
106
     * @example Luzern
107
     *
108
     * @return string
109
     */
110
    public function cityName()
111
    {
112
        return static::randomElement(static::$cityNames);
113
    }
114
 
115
    /**
116
     * Returns a canton
117
     *
118
     * @example array('BE' => 'Bern')
119
     *
120
     * @return array
121
     */
122
    public static function canton()
123
    {
124
        return static::randomElement(static::$canton);
125
    }
126
 
127
    /**
128
     * Returns the abbreviation of a canton.
129
     *
130
     * @return string
131
     */
132
    public static function cantonShort()
133
    {
134
        $canton = static::canton();
135
 
136
        return key($canton);
137
    }
138
 
139
    /**
140
     * Returns the name of canton.
141
     *
142
     * @return string
143
     */
144
    public static function cantonName()
145
    {
146
        $canton = static::canton();
147
 
148
        return current($canton);
149
    }
150
}