1
0
mirror of https://github.com/fzaninotto/Faker.git synced 2025-03-22 16:29:55 +01:00

add toAscii method to Italian Internet provider

This was inspired by issue #189. Copied and adapted from French Internet provider. Even if current Person provider for Italian does not contains any accented letters, I added them anyway, for forward compatibility. The only current issue with Italian Person provider are names with accent inside, that currently are translated into invalid email, like "ld'amico@yahoo.com"
This commit is contained in:
Massimiliano Arione 2013-11-12 16:35:37 +01:00
parent 080f944b01
commit c0311f607f

View File

@ -6,4 +6,17 @@ class Internet extends \Faker\Provider\Internet
{
protected static $freeEmailDomain = array('gmail.com', 'yahoo.com', 'hotmail.com', 'email.it', 'libero.it', 'yahoo.it');
protected static $tld = array('com', 'com', 'com', 'net', 'org', 'it', 'it', 'it');
/**
* Converts Italian characters to their ASCII representation
*
* @return string
*/
private static function toAscii($string)
{
$from = array('à', 'À', 'é', 'É', 'è', 'È', 'ù', 'Ù', "'");
$to = array('a', 'A', 'e', 'E', 'e', 'E', 'u', 'U', '');
return str_replace($from, $to, $string);
}
}