mirror of
https://github.com/fzaninotto/Faker.git
synced 2025-03-19 06:49:50 +01:00
Fixed typos
This commit is contained in:
parent
4f57d3f8dc
commit
cf4a23db11
@ -236,7 +236,7 @@ $populator->addEntity('Book', 10);
|
||||
$insertedPKs = $populator->execute();
|
||||
```
|
||||
|
||||
The populator uses name and column type guessers to populate each column with relevant data. For instance, Faker populates a column named `first_name` using the `firstName` formatter, and a column with a `TIMESTAMP` type using the `dateTime` formatter. The resulting entities are therefore coherent. If Faker misinterprets a column name, you can still specify a custom clusure to be used for populating a particular column, using the third argument to `addEntity()`:
|
||||
The populator uses name and column type guessers to populate each column with relevant data. For instance, Faker populates a column named `first_name` using the `firstName` formatter, and a column with a `TIMESTAMP` type using the `dateTime` formatter. The resulting entities are therefore coherent. If Faker misinterprets a column name, you can still specify a custom closure to be used for populating a particular column, using the third argument to `addEntity()`:
|
||||
|
||||
```php
|
||||
<?php
|
||||
@ -308,7 +308,7 @@ $faker->addProvider(new Faker\Provider\Internet($faker));
|
||||
|
||||
Whenever you try to access a property on the `$faker` object, the generator looks for a method with the same name in all the providers attached to it. For instance, calling `$faker->name` triggers a call to `Faker\Provider\Name::name()`. And since Faker starts with the last provider, you can easily override existing formatters: just add a provider containing methods named after the formatters you want to override.
|
||||
|
||||
That means that you can esily add your own providers to a `Faker\Generator` instance. A provider is usually a class extending `\Faker\Provider\Base`. This parent class allows you to use methods like `lexify()` or `randomNumber()`; it also gives you access to formatters of other providers, through the protected `$generator` property. The new formatters are the public methods of the provider class.
|
||||
That means that you can easily add your own providers to a `Faker\Generator` instance. A provider is usually a class extending `\Faker\Provider\Base`. This parent class allows you to use methods like `lexify()` or `randomNumber()`; it also gives you access to formatters of other providers, through the protected `$generator` property. The new formatters are the public methods of the provider class.
|
||||
|
||||
Here is an example provider for populating Book data:
|
||||
|
||||
|
@ -55,7 +55,7 @@ class Color extends Base
|
||||
*/
|
||||
public static function safeHexColor()
|
||||
{
|
||||
$color = str_pad(dechex(mt_rand(0,255)), 3, '0', STR_PAD_LEFT);
|
||||
$color = str_pad(dechex(mt_rand(0, 255)), 3, '0', STR_PAD_LEFT);
|
||||
|
||||
return '#' . $color[0] . $color[0] . $color[1] . $color[1] . $color[2] . $color[2];
|
||||
}
|
||||
@ -68,9 +68,9 @@ class Color extends Base
|
||||
$color = static::hexColor();
|
||||
|
||||
return array(
|
||||
hexdec(substr($color,1,2)),
|
||||
hexdec(substr($color,3,2)),
|
||||
hexdec(substr($color,5,2))
|
||||
hexdec(substr($color, 1, 2)),
|
||||
hexdec(substr($color, 3, 2)),
|
||||
hexdec(substr($color, 5, 2))
|
||||
);
|
||||
}
|
||||
|
||||
@ -105,5 +105,4 @@ class Color extends Base
|
||||
{
|
||||
return static::randomElement(static::$allColorNames);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -61,5 +61,4 @@ class Address extends \Faker\Provider\en_US\Address
|
||||
|
||||
return static::toUpper($string);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -47,5 +47,4 @@ class Person extends \Faker\Provider\Person
|
||||
{
|
||||
return static::randomElement(static::$prefix);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,5 +17,4 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber
|
||||
'0# #######',
|
||||
'0# ### ## ##',
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -174,7 +174,9 @@ class Company extends \Faker\Provider\Company
|
||||
$isEven = $i % 2 === 0;
|
||||
|
||||
$tmp = $isEven ? $digit * 2 : $digit;
|
||||
if ($tmp >= 10) $tmp -= 9;
|
||||
if ($tmp >= 10) {
|
||||
$tmp -= 9;
|
||||
}
|
||||
$sum += $tmp;
|
||||
|
||||
$siren = $digit . $siren;
|
||||
|
@ -31,7 +31,8 @@ class Internet extends \Faker\Provider\Internet
|
||||
$company = str_replace(
|
||||
array('ու','ա','բ','գ','դ','ե','զ','է','ը','թ','ժ','ի','լ','խ','ծ','կ','հ','ձ','ղ','ճ','մ','յ','ն','շ','ո','չ','պ','ջ','ռ','ս','վ','տ','ր','ց','փ','ք','և','օ','ֆ',),
|
||||
array('u','a','b','g','d','e','z','e','y','t','zh','i','l','kh','ts','k','h','dz','gh','ch','m','y','n','sh','o','ch','p','j','r','s','v','t','r','ts','p','q','ev','o','f'),
|
||||
$company);
|
||||
$company
|
||||
);
|
||||
|
||||
return $company;
|
||||
}
|
||||
|
@ -50,5 +50,4 @@ class Company extends \Faker\Provider\Company
|
||||
{
|
||||
return static::numerify(static::$vskFormat);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -124,13 +124,13 @@ class Person extends \Faker\Provider\Person
|
||||
$birthdate = new \DateTime('@' . mt_rand(0, time()));
|
||||
|
||||
// last four buffer
|
||||
$lastFour = NULL;
|
||||
$lastFour = null;
|
||||
|
||||
// security variable reference
|
||||
$ref = '32765432';
|
||||
|
||||
// valid flag
|
||||
$valid = FALSE;
|
||||
$valid = false;
|
||||
|
||||
while (! $valid) {
|
||||
// make two random numbers
|
||||
@ -151,7 +151,7 @@ class Person extends \Faker\Provider\Person
|
||||
if ($chk < 10) {
|
||||
$lastFour = $rand.$chk.substr($birthdate->format('Y'), 1, 1);
|
||||
|
||||
$valid = TRUE;
|
||||
$valid = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,5 +17,4 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber
|
||||
'0# #######',
|
||||
'0# ### ## ##',
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ namespace Faker\Provider\ua_UA;
|
||||
/**
|
||||
* Cyrillic to latin transliteration util
|
||||
*/
|
||||
Class Transliteration
|
||||
class Transliteration
|
||||
{
|
||||
/**
|
||||
* Translate cyrillic text to latin
|
||||
|
@ -19,7 +19,6 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase
|
||||
$generator = new Generator;
|
||||
$provider = new FooProvider();
|
||||
$generator->addProvider($provider);
|
||||
$expected = array($provider, 'fooFormatter');
|
||||
$this->assertTrue(is_callable($generator->getFormatter('fooFormatter')));
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,9 @@ abstract class IsValidSirenSiret extends \PHPUnit_Framework_Constraint
|
||||
|
||||
$code = str_replace(' ', '', $other);
|
||||
|
||||
if (strlen($code) != $this->getLength())
|
||||
if (strlen($code) != $this->getLength()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sum = 0;
|
||||
// IMPORTANT : from right to left
|
||||
|
@ -9,7 +9,7 @@ class LoremTest extends \PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testTextThrowsExceptionWhenAskedLextSizeLessThan5()
|
||||
public function testTextThrowsExceptionWhenAskedTextSizeLessThan5()
|
||||
{
|
||||
Lorem::text(4);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user