1
0
mirror of https://github.com/fzaninotto/Faker.git synced 2025-03-23 00:39:47 +01:00

Fixed: UTF-8 string - close #60

This commit is contained in:
toin0u 2012-11-10 00:24:29 +01:00 committed by Antoine Corcy
parent 0a89d8e662
commit 3d453394dc
9 changed files with 19 additions and 14 deletions

View File

@ -13,7 +13,7 @@ class Name
public function guessFormat($name)
{
$name = strtolower($name);
$name = static::toLower($name);
$generator = $this->generator;
if (preg_match('/^is[_A-Z]/', $name)) {
return function() use ($generator) { return $generator->boolean; };

View File

@ -77,7 +77,7 @@ class EntityPopulator
protected function isColumnBehavior($columnMap)
{
foreach ($columnMap->getTable()->getBehaviors() as $name => $params) {
$columnName = strtolower($columnMap->getName());
$columnName = static::toLower($columnMap->getName());
switch ($name) {
case 'nested_set':
$columnNames = array($params['left_column'], $params['right_column'], $params['level_column']);

View File

@ -79,7 +79,7 @@ class Address extends \Faker\Provider\Base
*/
public static function postcode()
{
return strtoupper(static::bothify(static::randomElement(static::$postcode)));
return static::toUpper(static::bothify(static::randomElement(static::$postcode)));
}
/**

View File

@ -74,7 +74,7 @@ class Lorem extends \Faker\Provider\Base
*
* @example 'Lorem ipsum dolor sit amet.'
* @param integer $nbWords around how many words the sentence should contain
* @param boolean $variableNbWords set to false if you want exactly $nbWords returned,
* @param boolean $variableNbWords set to false if you want exactly $nbWords returned,
* otherwise $nbWords may vary by +/-40% with a minimum of 1
* @return string
*/
@ -115,7 +115,7 @@ class Lorem extends \Faker\Provider\Base
*
* @example 'Sapiente sunt omnis. Ut pariatur ad autem ducimus et. Voluptas rem voluptas sint modi dolorem amet.'
* @param integer $nbSentences around how many sentences the paragraph should contain
* @param boolean $variableNbSentences set to false if you want exactly $nbSentences returned,
* @param boolean $variableNbSentences set to false if you want exactly $nbSentences returned,
* otherwise $nbSentences may vary by +/-40% with a minimum of 1
* @return string
*/
@ -173,7 +173,7 @@ class Lorem extends \Faker\Provider\Base
}
array_pop($text);
}
$text[0][0] = strtoupper($text[0][0]);
$text[0][0] = static::toUpper($text[0][0]);
$text[count($text) - 1] .= '.';
} else if ($maxNbChars < 100) {
// join sentences

View File

@ -235,9 +235,14 @@ class Address extends \Faker\Provider\Address
return static::randomElement(static::$streetSuffixWord);
}
/**
* Randomly return a building number.
*
* @return string
*/
public static function buildingNumber()
{
return strtoupper(static::bothify(static::randomElement(static::$buildingNumber)));
return static::toUpper(static::bothify(static::randomElement(static::$buildingNumber)));
}
/**

View File

@ -48,7 +48,7 @@ class Internet extends \Faker\Provider\Internet
public function userName()
{
$format = static::randomElement(static::$userNameFormats);
return strtolower(static::toAscii(static::bothify($this->generator->parse($format))));
return static::toLower(static::toAscii(static::bothify($this->generator->parse($format))));
}
/**
@ -62,6 +62,6 @@ class Internet extends \Faker\Provider\Internet
$company = $companyElements[0];
$company = preg_replace('/\W/', '', $company);
return strtolower(static::toAscii($company));
return static::toLower(static::toAscii($company));
}
}

View File

@ -27,7 +27,7 @@ class Internet extends \Faker\Provider\Internet
public function userName()
{
$format = static::randomElement(static::$userNameFormats);
return strtolower(static::toAscii(static::bothify($this->generator->parse($format))));
return static::toLower(static::toAscii(static::bothify($this->generator->parse($format))));
}
/**
@ -40,6 +40,6 @@ class Internet extends \Faker\Provider\Internet
$company = $companyElements[0];
$company = preg_replace('/\W/', '', $company);
return strtolower(static::toAscii($company));
return static::toLower(static::toAscii($company));
}
}

View File

@ -27,7 +27,7 @@ class Internet extends \Faker\Provider\Internet
public function userName()
{
$format = static::randomElement(static::$userNameFormats);
return strtolower(static::toAscii(static::bothify($this->generator->parse($format))));
return static::toLower(static::toAscii(static::bothify($this->generator->parse($format))));
}
/**
@ -40,6 +40,6 @@ class Internet extends \Faker\Provider\Internet
$company = $companyElements[0];
$company = preg_replace('/\W/', '', $company);
return strtolower(static::toAscii($company));
return static::toLower(static::toAscii($company));
}
}

View File

@ -115,7 +115,7 @@ class Address extends \Faker\Provider\Base
public static function postcode()
{
return strtoupper(static::bothify(static::randomElement(static::$postcode)));
return static::toUpper(static::bothify(static::randomElement(static::$postcode)));
}
public static function regionSuffix()