mirror of
https://github.com/fzaninotto/Faker.git
synced 2025-03-19 23:09:47 +01:00
Merge pull request #178 from hasandz/master
Improvements for Turkish internet provider
This commit is contained in:
commit
1b2a2a7807
@ -4,5 +4,43 @@ namespace Faker\Provider\tr_TR;
|
||||
|
||||
class Internet extends \Faker\Provider\Internet
|
||||
{
|
||||
protected static $tld = array('com', 'com', 'com', 'com', 'com', 'com.tr', 'biz', 'info', 'net', 'org','az');
|
||||
protected static $freeEmailDomain = array('gmail.com', 'hotmail.com', 'yahoo.com', 'mynet.com', 'ttmail.com', 'turk.net');
|
||||
protected static $tld = array('com', 'com', 'com', 'com', 'com.tr', 'com.tr', 'info', 'net', 'org', 'org.tr','edu', 'edu.tr', 'edu.tr');
|
||||
|
||||
/**
|
||||
* Converts Turkish characters to their ASCII representation
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function toAscii($string)
|
||||
{
|
||||
|
||||
$from = array('ı', 'İ', 'ç', 'Ç', 'ğ', 'Ğ', 'ş', 'Ş', 'ü', 'Ü', 'ö', 'Ö');
|
||||
$to = array('i', 'I', 'c', 'C', 'g', 'G', 's', 'S', 'u', 'U', 'o', 'O');
|
||||
|
||||
return str_replace($from, $to, $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* @example 'jdoe'
|
||||
*/
|
||||
public function userName()
|
||||
{
|
||||
$format = static::randomElement(static::$userNameFormats);
|
||||
|
||||
return static::toLower(static::toAscii(static::bothify($this->generator->parse($format))));
|
||||
}
|
||||
|
||||
/**
|
||||
* @example 'faber'
|
||||
*/
|
||||
public function domainWord()
|
||||
{
|
||||
$company = $this->generator->format('company');
|
||||
$companyElements = explode(' ', $company);
|
||||
$company = $companyElements[0];
|
||||
$company = preg_replace('/\W/u', '', $company);
|
||||
|
||||
return static::toLower(static::toAscii($company));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user