mirror of
https://github.com/fzaninotto/Faker.git
synced 2025-03-21 07:49:53 +01:00
Added Internet strings generation to es_ES provider
This commit is contained in:
parent
728dc177d5
commit
e07784503b
43
src/Faker/Provider/es_ES/Internet.php
Normal file
43
src/Faker/Provider/es_ES/Internet.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Faker\Provider\es_ES;
|
||||
|
||||
class Internet extends \Faker\Provider\Internet
|
||||
{
|
||||
protected static $freeEmailDomain = array('gmail.com', 'hotmail.com', 'hotmail.es', 'yahoo.com', 'yahoo.es', 'live.com', 'hispavista.com', 'latinmail.com', 'terra.com');
|
||||
protected static $tld = array('com', 'com', 'com', 'com', 'net', 'org', 'org', 'es', 'es', 'es', 'com.es');
|
||||
|
||||
/**
|
||||
* Converts French characters to their ASCII representation
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function toAscii($string)
|
||||
{
|
||||
$string = htmlentities($string, ENT_NOQUOTES, 'UTF-8');
|
||||
$string = preg_replace('/\W/', '-', preg_replace('/&(\w)\w+;/', '$1', $string));
|
||||
|
||||
return trim($string, '-');
|
||||
}
|
||||
|
||||
/**
|
||||
* @example 'jdoe'
|
||||
*/
|
||||
public function userName()
|
||||
{
|
||||
$format = static::randomElement(static::$userNameFormats);
|
||||
$user = static::bothify($this->generator->parse($format));
|
||||
|
||||
return str_replace('-', '.', static::toLower(static::toAscii($user)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @example 'faber'
|
||||
*/
|
||||
public function domainWord()
|
||||
{
|
||||
list($company) = explode(' ', $this->generator->format('company'));
|
||||
|
||||
return static::toLower(static::toAscii($company));
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user