Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Commit

Permalink
Added support for en_KE provider resulting from fzaninotto#1851
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Wanjiku committed Jan 14, 2020
1 parent fc0ee72 commit ae367cd
Show file tree
Hide file tree
Showing 4 changed files with 422 additions and 0 deletions.
188 changes: 188 additions & 0 deletions src/Faker/Provider/en_KE/Address.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
<?php

namespace Faker\Provider\en_KE;

class Address extends \Faker\Provider\Address
{
protected static $cityFormats = array(

'{{cityName}}',
);

protected static $addressFormats = array(
'P.O. BOX {{postcode}} {{county}}',
);

/**
* Kenya has got only three cities
*/
protected static $city = array('Nairobi','Mombasa','Kisumu');

/**
* Counties found in Kenya
* @see https://en.wikipedia.org/wiki/List_of_cities_and_towns_in_Kenya_by_population
*/
protected static $county = array(

'Baringo','Bomet','Bungoma','Busia','Elgeyo-marakwet',
'Embu','Garissa','Homabay','Isiolo','Kajiado','Kakamega',
'Kericho','Kiambu','Kilifi','Kirinyaga','Kisii','Kisumu',
'Kitui','Kwale','Laikipia','Lamu','Machakos','Makueni',
'Mandera','Marsabit','Meru','Migori','Mombasa','Murang\'a',
'Nairobi','Nakuru','Nandi','Narok','Nyamira','Nyandarua',
'Nyeri','Samburu','Siaya','Taita Taveta','Tana River',
'Tharaka-Nithi','Trans-Nzoia','Turkana','Uasin Gishu',
'Vihiga','Wajir','West Pokot',
);

/**
* Municipalities in Kenya
* @see https://en.wikipedia.org/wiki/List_of_cities_and_towns_in_Kenya_by_population
*/
protected static $municipality = array(

'Nakuru','Eldoret','Kehancha','Ruiru','Malindi','Naivasha',
'Kitui','Machakos','Thika','Athi River (Mavoko)','Nyeri',
'Vihiga','Wote','Mumias','Bomet','Kitale','Limuru','Kericho',
'Kimilili','Kakamega','Kapsabet','Kiambu','Kisii','Bungoma',
'Webuye','Busia','Runyenjes','Migori','Embu','Homabay','Lodwar',
'Meru','Nyahururu','Nanyuki','Maua','Voi','Siaya','Chuka',
'Kerugoya / Kutus',
);

protected static $country = array(
'Afghanistan', 'Albania', 'Algeria', 'American Samoa', 'Andorra',
'Angola', 'Anguilla', 'Antarctica (the territory South of 60 deg S)',
'Antigua and Barbuda', 'Argentina', 'Armenia', 'Aruba', 'Australia',
'Austria', 'Azerbaijan','Bahamas', 'Bahrain', 'Bangladesh', 'Barbados',
'Belarus', 'Belgium', 'Belize', 'Benin', 'Bermuda', 'Bhutan', 'Bolivia',
'Bosnia and Herzegovina', 'Botswana', 'Bouvet Island (Bouvetoya)',
'Brazil', 'British Indian Ocean Territory (Chagos Archipelago)',
'British Virgin Islands', 'Brunei Darussalam', 'Bulgaria', 'Burkina Faso',
'Burundi','Cambodia', 'Cameroon', 'Canada', 'Cape Verde', 'Cayman Islands',
'Central African Republic', 'Chad', 'Chile', 'China', 'Christmas Island',
'Cocos (Keeling) Islands', 'Colombia', 'Comoros', 'Congo', 'Congo',
'Cook Islands', 'Costa Rica', 'Cote d\'Ivoire', 'Croatia', 'Cuba', 'Cyprus',
'Czech Republic','Denmark', 'Djibouti', 'Dominica', 'Dominican Republic',
'Ecuador', 'Egypt', 'El Salvador', 'Equatorial Guinea', 'Eritrea', 'Estonia', 'Ethiopia',
'Faroe Islands', 'Falkland Islands (Malvinas)', 'Fiji', 'Finland', 'France', 'French Guiana', 'French Polynesia',
'French Southern Territories','Gabon', 'Gambia', 'Georgia', 'Germany', 'Ghana', 'Gibraltar', 'Greece',
'Greenland','Grenada', 'Guadeloupe', 'Guam', 'Guatemala', 'Guernsey', 'Guinea', 'Guinea-Bissau', 'Guyana',
'Haiti', 'Heard Island and McDonald Islands', 'Holy See (Vatican City State)', 'Honduras', 'Hong Kong',
'Hungary','Iceland', 'India', 'Indonesia', 'Iran', 'Iraq', 'Ireland', 'Isle of Man', 'Israel', 'Italy',
'Jamaica', 'Japan', 'Jersey', 'Jordan','Kazakhstan', 'Kenya', 'Kiribati', 'Korea', 'Korea',
'Kuwait', 'Kyrgyz Republic','Lao People\'s Democratic Republic', 'Latvia', 'Lebanon', 'Lesotho', 'Liberia',
'Libyan Arab Jamahiriya', 'Liechtenstein', 'Lithuania', 'Luxembourg','Macao',
'Macedonia', 'Madagascar', 'Malawi', 'Malaysia', 'Maldives', 'Mali', 'Malta', 'Marshall Islands', 'Martinique',
'Mauritania', 'Mauritius', 'Mayotte', 'Mexico', 'Micronesia', 'Moldova', 'Monaco', 'Mongolia', 'Montenegro',
'Montserrat', 'Morocco', 'Mozambique', 'Myanmar',
'Namibia', 'Nauru', 'Nepal', 'Netherlands Antilles', 'Netherlands', 'New Caledonia', 'New Zealand', 'Nicaragua',
'Niger', 'Nigeria', 'Niue', 'Norfolk Island', 'Northern Mariana Islands', 'Norway','Oman',
'Pakistan', 'Palau', 'Palestinian Territories', 'Panama', 'Papua New Guinea', 'Paraguay', 'Peru', 'Philippines',
'Pitcairn Islands', 'Poland', 'Portugal', 'Puerto Rico','Qatar',
'Reunion', 'Romania', 'Russian Federation', 'Rwanda',
'Saint Barthelemy', 'Saint Helena', 'Saint Kitts and Nevis', 'Saint Lucia', 'Saint Martin',
'Saint Pierre and Miquelon', 'Saint Vincent and the Grenadines', 'Samoa', 'San Marino', 'Sao Tome and Principe',
'Saudi Arabia', 'Senegal', 'Serbia', 'Seychelles', 'Sierra Leone', 'Singapore', 'Slovakia (Slovak Republic)',
'Slovenia', 'Solomon Islands', 'Somalia', 'South Africa', 'South Georgia and the South Sandwich Islands',
'Spain', 'Sri Lanka', 'Sudan', 'Suriname', 'Svalbard & Jan Mayen Islands', 'Swaziland', 'Sweden', 'Switzerland',
'Syrian Arab Republic','Taiwan', 'Tajikistan', 'Tanzania', 'Thailand', 'Timor-Leste', 'Togo', 'Tokelau',
'Tonga', 'Trinidad and Tobago', 'Tunisia', 'Turkey', 'Turkmenistan', 'Turks and Caicos Islands', 'Tuvalu',
'Uganda', 'Ukraine', 'United Arab Emirates', 'United Kingdom', 'United States of America',
'United States Minor Outlying Islands', 'United States Virgin Islands', 'Uruguay', 'Uzbekistan',
'Vanuatu', 'Venezuela', 'Vietnam','Wallis and Futuna', 'Western Sahara','Yemen','Zambia', 'Zimbabwe'
);

/**
* Towns found in Kenya
* @see https://en.wikipedia.org/wiki/List_of_cities_and_towns_in_Kenya_by_population
*/
public static $town = array(

'Kikuyu','Kangundo - tala','Karuri','Kilifi','Garissa','Molo','Litein','Mariakani',
'Mandera','Nyamira','Mwingi','Rongo','Ahero','Nandi Hills','Makuyu','Kapenguria',
'Taveta','Narok','Ol-Kalou','Malaba','Mbita Point','Malava','Suneka','Ogembo',
'Ukwala','Keroka','Matuu','Oyugis','Kipkelion','Luanda','Eldama Ravine','Nyansiongo',
'Londiani','Iten / Tambach','Malakisi','Bondo','Maralal','Nambale','Tabaka','Muhoroni',
'Ugunja','Yala','Rumuruti','Burnt Forest','Maragua','Kendu Bay',
);

/**
* Centers in Kenya
* @see https://en.wikipedia.org/wiki/List_of_cities_and_towns_in_Kenya_by_population
*/
public static $center = array(

'Ngong','Awasi','Wajir','Kakuma','Ukunda','Wundanyi','Kitengela','Mtwapa',
'Isiolo','Juja','Ongata Rongai','Moyale','Gilgil'
);

/**
* Streets in Kenya (Partial list for Nairobi only)
*/
public static $street = array(

'Moi Avenue','Kenyatta Avenue','Haile Sellasie Avenue',
'Muindi Mbingu Street','Tom Mboya Street','Ramesh Gautama Road','University Way',
'Luthuli Avenue','River Road','Taveta Road','Nyerere Road',
'Mombasa Road','Koinange Street','Parliament Road','Race Course Road','Lang\'ata Road',
'Uhuru Highway','Mama Ngina Street','Biashara Street','Kijabe Street','Mamlaka Road','Dorobo Road',
'Arboretum Drive','Kivemia Rd','State House Road','Lower State House Rd','Utalii Street','Loita Street',
'Market Street','Njugu Lane','Banda Street','Posta Street','Kaunda Street','City Hall Way','Harambee Avenue',
'Tumbo Avenue','Parliament Lane','Valley Road','Ragati Road','Chiromo Lane',
);

/**
* Get Counties in Kenya
* @example Kajiado
*/
public static function county()
{
return static::randomElement(static::$county);
}

/**
* Get municipalities in Kenya
* @example Nakuru
*/
public static function municipality()
{
return static::randomElement(static::$municipality);
}

/**
* Get towns in Kenya
* @example Garissa
*/
public static function town()
{
return static::randomElement(static::$town);
}

/**
* Get street name in Kenya
* @example Moi Avenue
*/
public static function street()
{
return static::randomElement(static::$street);
}

/**
* Get town centers in Kenya
* @example Kitengela
*/
public static function center()
{
return static::randomElement(static::$center);
}

/**
* Get cities in Kenya
* @example Nairobi
*/
public static function cityName()
{
return static::randomElement(static::$city);
}
}
13 changes: 13 additions & 0 deletions src/Faker/Provider/en_KE/Internet.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Faker\Provider\en_KE;

class Internet extends \Faker\Provider\Internet
{
protected static $tld = array(

'com','or.ke','co.ke','ne.ke','go.ke','ac.ke',
'sc.ke','me.ke','mobi.ke','info.ke','net','org','biz',
'info',
);
}
132 changes: 132 additions & 0 deletions src/Faker/Provider/en_KE/Person.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<?php

namespace Faker\Provider\en_KE;

class Person extends \Faker\Provider\Person
{
protected static $maleNameFormats = array(
'{{firstNameMale}} {{lastNameMale}}',
'{{firstNameMale}} {{firstNameMale}} {{lastNameMale}}'
);

protected static $femaleNameFormats = array(
'{{firstNameFemale}} {{lastNameFemale}}',
'{{firstNameFemale}} {{firstNameFemale}} {{lastNameFemale}}'
);

/**
* Typical Kenyan male firstnames
* @link https://github.com/uzziellite/Faker/blob/master/src/Faker/Provider/en_KE/Person.php
*/
protected static $firstNameMale = array(
'Trevor','Martin','Abubakar','Ibrahim','Alex','Allan','Amos','Nicholas','Andrew','Bakadi',
'Benson','Brian','Carlos','Teddy','Dancan','David','Dennis','Michael','Derrick','Deodre',
'Barnaby','Isaac','Jackson','James','Jeff','John','George','Joshua','Jude','Juniour',
'Cahill','Kevin','Johnstone','Kareem','Ryan','Brian','Leon','Lionel','Marvin','Emmanuel','Mark',
'Peter','Joel','Micky','Joseph','William','Reagan','Samuel','Earnest','Justin','Philip','Paul',
'Patrick','Fabian','Smith','Ramadhan','Santos','Shawn','Isaiah','Stephen','Stanley','Edwin','Maxwel',
'Tony','Victor','Vincent','Wilson','Yusuf','Rasael','Parker',
);

/**
* First names for Kenyan Females
* @link https://github.com/uzziellite/Faker/blob/master/src/Faker/Provider/en_KE/Person.php
*/
protected static $firstNameFemale = array(
'Mercy','Mary','Brenda','Angel','Frida','Rose','Anastacia','Margret','Tracey','Stacy','Agnes',
'Carol','Judy','Sharon','Amina','Coleta','Honorata','Renalda','Matrona','Jamie','Nazarene','Tonia',
'Azaria','Meda','Leyla','Purity','Ashley','Yvone','Nikki','Becky','Alice','Bella','Anna','Beryl','Aimee',
'Betty','Bianca','Kate','Celestine','Cesh','Angie','Cynthia','Dokia','Doreen','Dokia','Dota','Eunice',
'Eva','Faith','Favor','Hilda','Grace','Husna','Irene','Jane','Janet','Jenin','Joy','Joan','Kaila','Susan',
'Kaitlan','Kokki','Lenah','Lynn',
);

/**
* Kenyan Female Last Names
* @link https://github.com/uzziellite/Faker/blob/master/src/Faker/Provider/en_KE/Person.php
*/
protected static $lastNameFemale = array(
'Auma','Atieno','Mukhoya','Eshkumo','Nangila','Kananu','Ndinda','Muli','Mwende',
'Wairimu','Wangui','Wambui','Waithera','Wangare','Chebet','Chelang\'at','Wacheke',
'Sakimpa','Muthoni','Hadija','Amina','Taabu','Khamisi','Njeri','Njoki','Shiko',
'Semiryan','Mwangela','Malemba','Matunda','Chepkoech','Chelimo','Jelimo','Jepling\'',
'Radol','Ingavo','Ali','Mwajuma','Masitsa','Minayo','Ingutia','Kemunto','Nzano','Mukami',
'Abuor','Akech','Chepkemoi','Jebitok','Akello','Wamuyu','Kadzo','Karea',
);

/**
* Kenyan Male Last Names
* @link https://github.com/uzziellite/Faker/blob/master/src/Faker/Provider/en_KE/Person.php
*/
protected static $lastNameMale = array(

'Njenga','Kibet','Maina','Bambanya','Charo','Wafula','Asero','Barasa','Vaati','Wanjohi',
'Muinde','Mwikya','Kivanguli','Otieno','Okello','Okoth','Ouma','Kimani','Mwangi','Kipkurui',
'Njuguna','Kipkoech','Njoroge','Matagari','Indiatsi','Shionzo','Shipalapala','Leshitin','Kipkut',
'Lang\'at', 'Simel','Mwamburi','Mwadime','Poisa','Mwaisho','Mwasungia','Washala','Mwachofi',
'Onyancha','Musedi','Omondi','Ochola','Gogo','Osundwa','Mutua','Mwiti','Khabelwa','Mutethia',
'Agengo','Murage','Owino','Jatelo','Jalang\'o','Otoyo','Kiplimo','Kinuthia','Kariuki','Kaula','Ochieng\'',
);

/**
* ID Numbers of kenyans issued from 1970 - Present
*/
protected static $idNumber = array('8######','########');

/**
* Tax Payer PIN Number (KRA PIN) Format
*/
protected static $kraPin = array('?#########?');

/**
* Generate Kenyan Male Last Name
* @example Osundwa
*/
public function lastNameMale()
{
return static::randomElement(static::$lastNameMale);
}

/**
* Generate Kenyan Female Last Name
* @example Karea
*/
public function lastNameFemale()
{
return static::randomElement(static::$lastNameFemale);
}

/**
* Generate Kenyan Female Last Name
* @example Karea
*/
public function lastName($gender = null)
{
$gender = $gender ?? self::randomElement(['male','female']);
if ($gender === static::GENDER_MALE) {
return static::firstNameMale();
} elseif ($gender === static::GENDER_FEMALE) {
return static::firstNameFemale();
}

return $this->generator->parse(static::randomElement(static::$firstNameFormat));
}

/**
* Generate a valid Kenyan ID Number
* @example 01011101
*/
public function idNumber()
{
return static::numerify($this->generator->parse(static::randomElement(static::$idNumber)));
}

/**
* Generate a valid Kenyan KRA PIN
* @example Z001002321W
*/
public function kraPin()
{
return strtoupper(static::bothify($this->generator->parse(static::randomElement(static::$kraPin))));
}
}
Loading

0 comments on commit ae367cd

Please sign in to comment.