Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
[FEATURE] New providers de_CH, fr_CH, it_CH
Browse files Browse the repository at this point in the history
  • Loading branch information
r3h6 committed Oct 16, 2015
1 parent 9198c2f commit 54b9e41
Show file tree
Hide file tree
Showing 30 changed files with 20,667 additions and 0 deletions.
113 changes: 113 additions & 0 deletions src/Faker/Provider/de_CH/Address.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?php

namespace Faker\Provider\de_CH;

class Address extends \Faker\Provider\Address
{
protected static $buildingNumber = array('###', '##', '#', '#a', '#b', '#c');

protected static $streetSuffixLong = array(
'Gasse', 'Platz', 'Ring', 'Strasse', 'Weg', 'Allee'
);
protected static $streetSuffixShort = array(
'gasse', 'platz', 'ring', 'strasse', 'str.', 'weg', 'allee'
);

protected static $postcode = array('####');

protected static $cityNames = array(
'Aarau', 'Aarberg', 'Aarburg', 'Adliswil', 'Aesch', 'Affoltern am Albis', 'Agno', 'Aigle', 'Allschwil', 'Altdorf', 'Altstätten', 'Amriswil', 'Appenzell', 'Arbon', 'Arth', 'Ascona', 'Aubonne', 'Avenches', 'Baar', 'Bad Zurzach', 'Baden', 'Basel', 'Bassersdorf', 'Bellinzona', 'Belp', 'Bern', 'Beromünster', 'Biasca', 'Biel/Bienne', 'Binningen', 'Birsfelden', 'Bischofszell', 'Boudry', 'Bourg-Saint-Pierre', 'Bremgarten', 'Brig-Glis', 'Brig', 'Brugg', 'Buchs', 'Bulle', 'Burgdorf', 'Bülach', 'Carouge', 'Cham', 'Chur', 'Châtel-Saint-Denis', 'Chêne-Bougeries', 'Conthey', 'Coppet', 'Cossonay', 'Croglio', 'Cudrefin', 'Cully', 'Davos', 'Delsberg', 'Diessenhofen', 'Dietikon', 'Dübendorf', 'Ebikon', 'Echallens', 'Ecublens', 'Eglisau', 'Einsiedeln', 'Elgg', 'Emmen', 'Erlach', 'Estavayer-le-Lac', 'Flawil', 'Frauenfeld', 'Freiburg', 'Freienbach', 'Fürstenau', 'Genf', 'Gland', 'Glarus', 'Gordola', 'Gossau', 'Grandcour', 'Grandson', 'Greifensee', 'Grenchen', 'Greyerz', 'Grüningen', 'Herisau', 'Hermance', 'Hinwil', 'Horgen', 'Horw', 'Huttwil', 'Ilanz', 'Illnau-Effretikon', 'Ittigen', 'Kaiserstuhl', 'Klingnau', 'Kloten', 'Kreuzlingen', 'Kriens', 'Köniz', 'Küsnacht', 'La Chaux-de-Fonds', 'La Neuveville', 'La Sarraz', 'La Tour-de-Peilz', 'La Tour-de-Trême', 'Lachen', 'Lancy', 'Langenthal', 'Laufen', 'Laufenburg', 'Laupen', 'Lausanne', 'Le Grand-Saconnex', 'Le Landeron', 'Le Locle', 'Lenzburg', 'Les Clées', 'Leuk', 'Lichtensteig', 'Liestal', 'Locarno', 'Losone', 'Lugano', 'Lutry', 'Luzern', 'Lyss', 'Maienfeld', 'Martigny', 'Meilen', 'Mellingen', 'Mendrisio', 'Meyrin', 'Monthey', 'Montreux', 'Morcote', 'Morges', 'Moudon', 'Moutier', 'Muri bei Bern', 'Murten', 'Muttenz', 'Männedorf', 'Möhlin', 'Münchenstein', 'Münsingen', 'Neuenburg', 'Neuhausen am Rheinfall', 'Neunkirch', 'Nidau', 'Nyon', 'Oberwil', 'Oftringen', 'Olten', 'Onex', 'Opfikon', 'Orbe', 'Orsières', 'Ostermundigen', 'Payerne', 'Pfäffikon', 'Plan-les-Ouates', 'Pratteln', 'Prilly', 'Pruntrut', 'Pully', 'Rapperswil-Jona', 'Regensberg', 'Regensdorf', 'Reinach', 'Renens', 'Rheinau', 'Rheineck', 'Rheinfelden', 'Richterswil', 'Riehen', 'Risch', 'Riva San Vitale', 'Rolle', 'Romainmôtier', 'Romanshorn', 'Romont', 'Rorschach', 'Rue', 'Rüti', 'Saillon', 'Saint-Maurice', 'Saint-Prex', 'Saint-Ursanne', 'Sala', 'Sargans', 'Sarnen', 'Schaffhausen', 'Schlieren', 'Schwyz', 'Sembrancher', 'Sempach', 'Siders', 'Sitten', 'Solothurn', 'Spiez', 'Splügen', 'Spreitenbach', 'St. Gallen', 'Stans', 'Steckborn', 'Steffisburg', 'Stein am Rhein', 'Stäfa', 'Sursee', 'Thalwil', 'Thun', 'Thusis', 'Thônex', 'Unterseen', 'Uster', 'Uznach', 'Uzwil', 'Val-de-Travers NE', 'Valangin', 'Vernier', 'Versoix', 'Vevey', 'Veyrier GE', 'Villars-sur-Glâne', 'Villeneuve', 'Visp', 'Volketswil', 'Waldenburg', 'Walenstadt', 'Wallisellen', 'Wangen an der Aare', 'Weinfelden', 'Werdenberg', 'Wettingen', 'Wetzikon', 'Wiedlisbach', 'Willisau', 'Wil', 'Winterthur', 'Wohlen', 'Worb', 'Wädenswil', 'Yverdon-les-Bains', 'Zofingen', 'Zollikon', 'Zug', 'Zürich'
);

protected static $canton = array(
array('short' => 'AG', 'name' => 'Aargau'), array('short' => 'AI', 'name' => 'Appenzell Innerrhoden'), array('short' => 'AR', 'name' => 'Appenzell Ausserrhoden'), array('short' => 'BE', 'name' => 'Bern'), array('short' => 'BL', 'name' => 'Basel-Landschaft'), array('short' => 'BS', 'name' => 'Basel-Stadt'), array('short' => 'FR', 'name' => 'Freiburg'), array('short' => 'GE', 'name' => 'Genf'), array('short' => 'GL', 'name' => 'Glarus'), array('short' => 'GR', 'name' => 'Graubünden'), array('short' => 'JU', 'name' => 'Jura',), array('short' => 'LU', 'name' => 'Luzern'), array('short' => 'NE', 'name' => 'Neuenburg'), array('short' => 'NW', 'name' => 'Nidwalden'), array('short' => 'OW', 'name' => 'Obwalden'), array('short' => 'SG', 'name' => 'St. Gallen'), array('short' => 'SH', 'name' => 'Schaffhausen'), array('short' => 'SO', 'name' => 'Solothurn'), array('short' => 'SZ', 'name' => 'Schwyz'), array('short' => 'TG', 'name' => 'Thurgau'), array('short' => 'TI', 'name' => 'Tessin'), array('short' => 'UR', 'name' => 'Uri'), array('short' => 'VD', 'name' => 'Waadt'), array('short' => 'VS', 'name' => 'Wallis'), array('short' => 'ZG', 'name' => 'Zug'), array('short' => 'ZH', 'name' => 'Zürich')
);

protected static $country = array(
'Afghanistan', 'Alandinseln', 'Albanien', 'Algerien', 'Amerikanisch-Ozeanien', 'Amerikanisch-Samoa', 'Amerikanische Jungferninseln', 'Andorra', 'Angola', 'Anguilla', 'Antarktis', 'Antigua und Barbuda', 'Argentinien', 'Armenien', 'Aruba', 'Aserbaidschan', 'Australien', 'Ägypten', 'Äquatorialguinea', 'Äthiopien', 'Äusseres Ozeanien',
'Bahamas', 'Bahrain', 'Bangladesch', 'Barbados', 'Belarus', 'Belgien', 'Belize', 'Benin', 'Bermuda', 'Bhutan', 'Bolivien', 'Bosnien und Herzegowina', 'Botsuana', 'Bouvetinsel', 'Brasilien', 'Britische Jungferninseln', 'Britisches Territorium im Indischen Ozean', 'Brunei Darussalam', 'Bulgarien', 'Burkina Faso', 'Burundi',
'Chile', 'China', 'Cookinseln', 'Costa Rica', 'Côte d’Ivoire',
'Demokratische Republik Kongo', 'Demokratische Volksrepublik Korea', 'Deutschland', 'Dominica', 'Dominikanische Republik', 'Dschibuti', 'Dänemark',
'Ecuador', 'El Salvador', 'Eritrea', 'Estland', 'Europäische Union',
'Falklandinseln', 'Fidschi', 'Finnland', 'Frankreich', 'Französisch-Guayana', 'Französisch-Polynesien', 'Französische Süd- und Antarktisgebiete', 'Färöer',
'Gabun', 'Gambia', 'Georgien', 'Ghana', 'Gibraltar', 'Grenada', 'Griechenland', 'Grönland', 'Guadeloupe', 'Guam', 'Guatemala', 'Guernsey', 'Guinea', 'Guinea-Bissau', 'Guyana',
'Haiti', 'Heard- und McDonald-Inseln', 'Honduras',
'Indien', 'Indonesien', 'Irak', 'Iran', 'Irland', 'Island', 'Isle of Man', 'Israel', 'Italien',
'Jamaika', 'Japan', 'Jemen', 'Jersey', 'Jordanien',
'Kaimaninseln', 'Kambodscha', 'Kamerun', 'Kanada', 'Kap Verde', 'Kasachstan', 'Katar', 'Kenia', 'Kirgisistan', 'Kiribati', 'Kokosinseln', 'Kolumbien', 'Komoren', 'Kongo', 'Kroatien', 'Kuba', 'Kuwait',
'Laos', 'Lesotho', 'Lettland', 'Libanon', 'Liberia', 'Libyen', 'Liechtenstein', 'Litauen', 'Luxemburg',
'Madagaskar', 'Malawi', 'Malaysia', 'Malediven', 'Mali', 'Malta', 'Marokko', 'Marshallinseln', 'Martinique', 'Mauretanien', 'Mauritius', 'Mayotte', 'Mazedonien', 'Mexiko', 'Mikronesien', 'Monaco', 'Mongolei', 'Montenegro', 'Montserrat', 'Mosambik', 'Myanmar',
'Namibia', 'Nauru', 'Nepal', 'Neukaledonien', 'Neuseeland', 'Nicaragua', 'Niederlande', 'Niederländische Antillen', 'Niger', 'Nigeria', 'Niue', 'Norfolkinsel', 'Norwegen', 'Nördliche Marianen',
'Oman', 'Osttimor', 'Österreich',
'Pakistan', 'Palau', 'Palästinensische Gebiete', 'Panama', 'Papua-Neuguinea', 'Paraguay', 'Peru', 'Philippinen', 'Pitcairn', 'Polen', 'Portugal', 'Puerto Rico',
'Republik Korea', 'Republik Moldau', 'Ruanda', 'Rumänien', 'Russische Föderation', 'Réunion',
'Salomonen', 'Sambia', 'Samoa', 'San Marino', 'Saudi-Arabien', 'Schweden', 'Schweiz', 'Senegal', 'Serbien', 'Serbien und Montenegro', 'Seychellen', 'Sierra Leone', 'Simbabwe', 'Singapur', 'Slowakei', 'Slowenien', 'Somalia', 'Sonderverwaltungszone Hongkong', 'Sonderverwaltungszone Macao', 'Spanien', 'Sri Lanka', 'St. Barthélemy', 'St. Helena', 'St. Kitts und Nevis', 'St. Lucia', 'St. Martin', 'St. Pierre und Miquelon', 'St. Vincent und die Grenadinen', 'Sudan', 'Suriname', 'Svalbard und Jan Mayen', 'Swasiland', 'Syrien', 'São Tomé und Príncipe', 'Südafrika', 'Südgeorgien und die Südlichen Sandwichinseln',
'Tadschikistan', 'Taiwan', 'Tansania', 'Thailand', 'Togo', 'Tokelau', 'Tonga', 'Trinidad und Tobago', 'Tschad', 'Tschechische Republik', 'Tunesien', 'Turkmenistan', 'Turks- und Caicosinseln', 'Tuvalu', 'Türkei',
'Uganda', 'Ukraine', 'Unbekannte oder ungültige Region', 'Ungarn', 'Uruguay', 'Usbekistan',
'Vanuatu', 'Vatikanstadt', 'Venezuela', 'Vereinigte Arabische Emirate', 'Vereinigte Staaten', 'Vereinigtes Königreich', 'Vietnam',
'Wallis und Futuna', 'Weihnachtsinsel', 'Westsahara',
'Zentralafrikanische Republik', 'Zypern',
);

protected static $cityFormats = array(
'{{cityName}}',
);

protected static $streetNameFormats = array(
'{{lastName}}{{streetSuffixShort}}',
'{{cityName}}{{streetSuffixShort}}',
'{{firstName}}-{{lastName}}-{{streetSuffixLong}}'
);

protected static $streetAddressFormats = array(
'{{streetName}} {{buildingNumber}}',
);
protected static $addressFormats = array(
"{{streetAddress}}\n{{postcode}} {{city}}",
);

public function cityName()
{
return static::randomElement(static::$cityNames);
}

public function streetSuffixShort()
{
return static::randomElement(static::$streetSuffixShort);
}

public function streetSuffixLong()
{
return static::randomElement(static::$streetSuffixLong);
}

/**
* Returns a canton
* @example array('BE' => 'Bern')
* @return array
*/
public static function canton()
{
return static::randomElement(static::$canton);
}

/**
* Returns the abbreviation of a canton.
* @return string
*/
public static function cantonShort()
{
$canton = static::canton();
return $canton['short'];
}

/**
* Returns the name of canton.
* @return string
*/
public static function cantonName()
{
$canton = static::canton();
return $canton['name'];
}
}
15 changes: 15 additions & 0 deletions src/Faker/Provider/de_CH/Company.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Faker\Provider\de_CH;

class Company extends \Faker\Provider\Company
{
protected static $formats = array(
'{{lastName}} {{companySuffix}}',
'{{lastName}} {{lastName}} {{companySuffix}}',
'{{lastName}}',
'{{lastName}}',
);

protected static $companySuffix = array('AG', 'GmbH');
}
9 changes: 9 additions & 0 deletions src/Faker/Provider/de_CH/Internet.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Faker\Provider\de_CH;

class Internet extends \Faker\Provider\Internet
{
protected static $freeEmailDomain = array('gmail.com', 'hotmail.com', 'yahoo.com', 'googlemail.com', 'gmx.ch', 'bluewin.ch', 'swissonline.ch');
protected static $tld = array('com', 'com', 'com', 'net', 'org', 'li', 'ch', 'ch');
}
19 changes: 19 additions & 0 deletions src/Faker/Provider/de_CH/Payment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Faker\Provider\de_CH;

class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'CH', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}
Loading

0 comments on commit 54b9e41

Please sign in to comment.