From cf4a23db11391c16f76b34e5a46ee674a49722ed Mon Sep 17 00:00:00 2001 From: Pascal Borreli Date: Thu, 4 Jul 2013 23:57:11 +0100 Subject: [PATCH] Fixed typos --- readme.md | 4 ++-- src/Faker/Provider/Color.php | 9 ++++----- src/Faker/Provider/en_CA/Address.php | 1 - src/Faker/Provider/fr_BE/Person.php | 1 - src/Faker/Provider/fr_BE/PhoneNumber.php | 1 - src/Faker/Provider/fr_FR/Company.php | 4 +++- src/Faker/Provider/hy_AM/Internet.php | 3 ++- src/Faker/Provider/is_IS/Company.php | 1 - src/Faker/Provider/is_IS/Person.php | 6 +++--- src/Faker/Provider/nl_BE/PhoneNumber.php | 1 - src/Faker/Provider/ua_UA/Transliteration.php | 2 +- test/Faker/GeneratorTest.php | 1 - .../PHPUnit/Framework/Constraint/IsValidSirenSiret.php | 3 ++- test/Faker/Provider/LoremTest.php | 2 +- 14 files changed, 18 insertions(+), 21 deletions(-) diff --git a/readme.md b/readme.md index 257b35a2..465ff2b5 100644 --- a/readme.md +++ b/readme.md @@ -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 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: diff --git a/src/Faker/Provider/Color.php b/src/Faker/Provider/Color.php index 2384771a..468aa4c0 100644 --- a/src/Faker/Provider/Color.php +++ b/src/Faker/Provider/Color.php @@ -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); } - } diff --git a/src/Faker/Provider/en_CA/Address.php b/src/Faker/Provider/en_CA/Address.php index 0aef7e9f..8f448717 100644 --- a/src/Faker/Provider/en_CA/Address.php +++ b/src/Faker/Provider/en_CA/Address.php @@ -61,5 +61,4 @@ class Address extends \Faker\Provider\en_US\Address return static::toUpper($string); } - } diff --git a/src/Faker/Provider/fr_BE/Person.php b/src/Faker/Provider/fr_BE/Person.php index 92a2090b..22d14303 100644 --- a/src/Faker/Provider/fr_BE/Person.php +++ b/src/Faker/Provider/fr_BE/Person.php @@ -47,5 +47,4 @@ class Person extends \Faker\Provider\Person { return static::randomElement(static::$prefix); } - } diff --git a/src/Faker/Provider/fr_BE/PhoneNumber.php b/src/Faker/Provider/fr_BE/PhoneNumber.php index 97fc4555..13249e02 100644 --- a/src/Faker/Provider/fr_BE/PhoneNumber.php +++ b/src/Faker/Provider/fr_BE/PhoneNumber.php @@ -17,5 +17,4 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber '0# #######', '0# ### ## ##', ); - } diff --git a/src/Faker/Provider/fr_FR/Company.php b/src/Faker/Provider/fr_FR/Company.php index b00143c6..4e61e90a 100644 --- a/src/Faker/Provider/fr_FR/Company.php +++ b/src/Faker/Provider/fr_FR/Company.php @@ -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; diff --git a/src/Faker/Provider/hy_AM/Internet.php b/src/Faker/Provider/hy_AM/Internet.php index 46a78b8c..c8167314 100644 --- a/src/Faker/Provider/hy_AM/Internet.php +++ b/src/Faker/Provider/hy_AM/Internet.php @@ -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; } diff --git a/src/Faker/Provider/is_IS/Company.php b/src/Faker/Provider/is_IS/Company.php index a8f6c9f8..6b934519 100644 --- a/src/Faker/Provider/is_IS/Company.php +++ b/src/Faker/Provider/is_IS/Company.php @@ -50,5 +50,4 @@ class Company extends \Faker\Provider\Company { return static::numerify(static::$vskFormat); } - } diff --git a/src/Faker/Provider/is_IS/Person.php b/src/Faker/Provider/is_IS/Person.php index e9b49fed..d6e574a1 100644 --- a/src/Faker/Provider/is_IS/Person.php +++ b/src/Faker/Provider/is_IS/Person.php @@ -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; } } diff --git a/src/Faker/Provider/nl_BE/PhoneNumber.php b/src/Faker/Provider/nl_BE/PhoneNumber.php index 25199cf1..ac17f1b1 100644 --- a/src/Faker/Provider/nl_BE/PhoneNumber.php +++ b/src/Faker/Provider/nl_BE/PhoneNumber.php @@ -17,5 +17,4 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber '0# #######', '0# ### ## ##', ); - } diff --git a/src/Faker/Provider/ua_UA/Transliteration.php b/src/Faker/Provider/ua_UA/Transliteration.php index b72cf779..1a4754bf 100644 --- a/src/Faker/Provider/ua_UA/Transliteration.php +++ b/src/Faker/Provider/ua_UA/Transliteration.php @@ -5,7 +5,7 @@ namespace Faker\Provider\ua_UA; /** * Cyrillic to latin transliteration util */ -Class Transliteration +class Transliteration { /** * Translate cyrillic text to latin diff --git a/test/Faker/GeneratorTest.php b/test/Faker/GeneratorTest.php index 4b875c28..147d9ddd 100644 --- a/test/Faker/GeneratorTest.php +++ b/test/Faker/GeneratorTest.php @@ -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'))); } diff --git a/test/Faker/PHPUnit/Framework/Constraint/IsValidSirenSiret.php b/test/Faker/PHPUnit/Framework/Constraint/IsValidSirenSiret.php index b473f25a..2b2f23e0 100644 --- a/test/Faker/PHPUnit/Framework/Constraint/IsValidSirenSiret.php +++ b/test/Faker/PHPUnit/Framework/Constraint/IsValidSirenSiret.php @@ -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 diff --git a/test/Faker/Provider/LoremTest.php b/test/Faker/Provider/LoremTest.php index 2b31e606..62785d43 100644 --- a/test/Faker/Provider/LoremTest.php +++ b/test/Faker/Provider/LoremTest.php @@ -9,7 +9,7 @@ class LoremTest extends \PHPUnit_Framework_TestCase /** * @expectedException \InvalidArgumentException */ - public function testTextThrowsExceptionWhenAskedLextSizeLessThan5() + public function testTextThrowsExceptionWhenAskedTextSizeLessThan5() { Lorem::text(4); }