1
0
mirror of https://github.com/fzaninotto/Faker.git synced 2025-03-24 01:09:50 +01:00

Fix coding standards (run php-cs-fixer)

This commit is contained in:
Francois Zaninotto 2014-03-13 19:33:34 +01:00
parent 3087b69d33
commit 4ca3829d9d
12 changed files with 27 additions and 63 deletions

View File

@ -106,7 +106,7 @@ class EntityPopulator
if ($mapping['targetEntity'] == $relatedClass) {
if ($mapping['type'] == ClassMetadata::ONE_TO_ONE) {
$unique = true;
$optional = isset($mapping['joinColumns'][0]['nullable']) ? $mapping['joinColumns'][0]['nullable'] : false;
$optional = isset($mapping['joinColumns'][0]['nullable']) ? $mapping['joinColumns'][0]['nullable'] : false;
break;
}
}

View File

@ -10,18 +10,19 @@ class Barcode extends \Faker\Provider\Base
private function ean($length=13)
{
$code = array();
for($i = 0; $i < $length - 1; $i++) {
for ($i = 0; $i < $length - 1; $i++) {
$code[] = static::randomDigit();
}
$sequence = $length == 8 ? array(3, 1) : array(1, 3);
$sums = 0;
foreach($code as $n => $digit) {
foreach ($code as $n => $digit) {
$sums += $digit * $sequence[$n % 2];
}
$checksum = (10 - $sums % 10) % 10;
return implode('', $code) . $checksum;
}

View File

@ -126,11 +126,11 @@ class Base
/**
* Returns random elements from a provided array
*
* @param array $array Array to take elements from. Defaults to a-f
* @param integer $count Number of elements to take.
* @param array $array Array to take elements from. Defaults to a-f
* @param integer $count Number of elements to take.
* @throws \LengthException When requesting more elements than provided
*
* @return array New array with $count elements from $array
* @return array New array with $count elements from $array
*/
public static function randomElements(array $array = array('a', 'b', 'c'), $count = 1)
{
@ -171,6 +171,7 @@ class Base
return null;
}
$elements = static::randomElements($array, 1);
return $elements[0];
}

View File

@ -11,19 +11,19 @@ class DateTime extends \Faker\Provider\Base
if (is_numeric($max)) {
return (int) $max;
}
if ($max instanceof \DateTime) {
return $max->getTimestamp();
}
return strtotime(empty($max) ? 'now' : $max);
}
/**
* Get a timestamp between January 1, 1970 and now
*
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
*
*
* @example 1061306726
*/
public static function unixTime($max = 'now')
@ -57,7 +57,7 @@ class DateTime extends \Faker\Provider\Base
/**
* get a date string formatted with ISO8601
*
*
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @example '2003-10-21T16:05:52+0000'
*/
@ -69,8 +69,8 @@ class DateTime extends \Faker\Provider\Base
/**
* Get a date string between January 1, 1970 and now
*
* @param string $format
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @param string $format
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @example '2008-11-27'
*/
public static function date($format = 'Y-m-d', $max = 'now')
@ -81,8 +81,8 @@ class DateTime extends \Faker\Provider\Base
/**
* Get a time string (24h format by default)
*
* @param string $format
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @param string $format
* @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now"
* @example '15:02:34'
*/
public static function time($format = 'H:i:s', $max = 'now')
@ -103,11 +103,11 @@ class DateTime extends \Faker\Provider\Base
{
$startTimestamp = $startDate instanceof \DateTime ? $startDate->getTimestamp() : strtotime($startDate);
$endTimestamp = static::getMaxTimestamp($endDate);
if ($startTimestamp > $endTimestamp) {
throw new \InvalidArgumentException('Start date must be anterior to end date.');
}
$timestamp = mt_rand($startTimestamp, $endTimestamp);
$ts = new \DateTime('@' . $timestamp);

View File

@ -16,8 +16,8 @@ abstract class Text extends \Faker\Provider\Base
* possible following words as the value.
*
* @example 'Alice, swallowing down her flamingo, and began by taking the little golden key'
* @param integer $maxNbChars Maximum number of characters the text should contain (minimum: 10)
* @param integer $indexSize Determines how many words are considered for the generation of the next word.
* @param integer $maxNbChars Maximum number of characters the text should contain (minimum: 10)
* @param integer $indexSize Determines how many words are considered for the generation of the next word.
* The minimum is 1, and it produces the higher level of randomness, although the
* generated text usually doesn't make sense. Higher index sizes (up to 5)
* produce more correct text, at the price of less randomness.

View File

@ -58,5 +58,4 @@ class Address extends \Faker\Provider\Address
return static::randomElement(static::$streetNames);
}
}

View File

@ -28,7 +28,6 @@ class Person extends \Faker\Provider\Person
private static $prefix = array('মি.', 'মিসেস. ', 'মিস.');
public static function prefix()
{
return static::randomElement(static::$prefix);

View File

@ -2,13 +2,13 @@
namespace Faker\Provider\bn_BD;
class Utils
{
public static function getBanglaNumber($number)
{
$english = range(0, 10);
$bangla = array('', '১', '২', '৩', '', '৫', '৬', '', '৮', '৯');
return str_replace($english, $bangla, $number);
}
}
}

View File

@ -1676,7 +1676,7 @@ hervor und sah noch dort unten im Schatten der hohen Lindenbäume ihr weißes Kl
nach der Gartentür schimmern, ich streckte meine Arme aus, und es verschwand.
EOT;
/*
End of the Project Gutenberg EBook of Die Leiden des jungen Werther--Buch 1, by
End of the Project Gutenberg EBook of Die Leiden des jungen Werther--Buch 1, by
Johann Wolfgang von Goethe
*** END OF THIS PROJECT GUTENBERG EBOOK DIE LEIDEN DES JUNGEN WERTHER ***
@ -1689,7 +1689,6 @@ EOT;
with proofreading and correction by Dr. Mary Cicora,
mcicora@yahoo.com.
Updated editions will replace the previous one--the old editions
will be renamed.
@ -1710,8 +1709,6 @@ EOT;
subject to the trademark license, especially commercial
redistribution.
*** START: FULL LICENSE ***
THE FULL PROJECT GUTENBERG LICENSE
@ -1724,7 +1721,6 @@ EOT;
Gutenberg-tm License (available with this file or online at
http://gutenberg.org/license).
Section 1. General Terms of Use and Redistributing Project Gutenberg-tm
electronic works
@ -1937,7 +1933,6 @@ EOT;
work, (b) alteration, modification, or additions or deletions to any
Project Gutenberg-tm work, and (c) any Defect you cause.
Section 2. Information about the Mission of Project Gutenberg-tm
Project Gutenberg-tm is synonymous with the free distribution of
@ -1982,7 +1977,6 @@ EOT;
Chief Executive and Director
gbnewby@pglaf.org
Section 4. Information about Donations to the Project Gutenberg
Literary Archive Foundation
@ -2017,7 +2011,6 @@ EOT;
ways including checks, online payments and credit card donations.
To donate, please visit: http://pglaf.org/donate
Section 5. General Information About Project Gutenberg-tm electronic
works.
@ -2026,13 +2019,11 @@ EOT;
with anyone. For thirty years, he produced and distributed Project
Gutenberg-tm eBooks with only a loose network of volunteer support.
Project Gutenberg-tm eBooks are often created from several printed
editions, all of which are confirmed as Public Domain in the U.S.
unless a copyright notice is included. Thus, we do not necessarily
keep eBooks in compliance with any particular paper edition.
Most people start at our Web site which has the main PG search facility:
http://www.gutenberg.org

View File

@ -245,9 +245,6 @@ So she set to work, and very soon finished off the cake.
* * * * * * *
CHAPTER II. The Pool of Tears
'Curiouser and curiouser!' cried Alice (she was so much surprised, that
@ -3085,7 +3082,6 @@ name 'Alice!'
CHAPTER XII. Alice's Evidence
'Here!' cried Alice, quite forgetting in the flurry of the moment how
large she had grown in the last few minutes, and she jumped up in such
a hurry that she tipped over the jury-box with the edge of her skirt,
@ -3377,8 +3373,6 @@ EOT;
This and all associated files of various formats will be found in:
http://www.gutenberg.org/1/11/
Updated editions will replace the previous one--the old editions
will be renamed.
@ -3399,8 +3393,6 @@ EOT;
subject to the trademark license, especially commercial
redistribution.
*** START: FULL LICENSE ***
THE FULL PROJECT GUTENBERG LICENSE
@ -3413,7 +3405,6 @@ EOT;
Gutenberg-tm License (available with this file or online at
http://gutenberg.org/license).
Section 1. General Terms of Use and Redistributing Project Gutenberg-tm
electronic works
@ -3626,7 +3617,6 @@ EOT;
work, (b) alteration, modification, or additions or deletions to any
Project Gutenberg-tm work, and (c) any Defect you cause.
Section 2. Information about the Mission of Project Gutenberg-tm
Project Gutenberg-tm is synonymous with the free distribution of
@ -3671,7 +3661,6 @@ EOT;
Chief Executive and Director
gbnewby@pglaf.org
Section 4. Information about Donations to the Project Gutenberg
Literary Archive Foundation
@ -3706,7 +3695,6 @@ EOT;
ways including checks, online payments and credit card donations.
To donate, please visit: http://pglaf.org/donate
Section 5. General Information About Project Gutenberg-tm electronic
works.
@ -3715,13 +3703,11 @@ EOT;
with anyone. For thirty years, he produced and distributed Project
Gutenberg-tm eBooks with only a loose network of volunteer support.
Project Gutenberg-tm eBooks are often created from several printed
editions, all of which are confirmed as Public Domain in the U.S.
unless a copyright notice is included. Thus, we do not necessarily
keep eBooks in compliance with any particular paper edition.
Most people start at our Web site which has the main PG search facility:
http://www.gutenberg.org

View File

@ -11,7 +11,7 @@ class Text extends \Faker\Provider\Text
* almost no restrictions whatsoever. You may copy it, give it away or
* re-use it under the terms of the Project Gutenberg License included
* with this eBook or online at www.gutenberg.net
*
*
* Title: Madame Bovary
* Author: Gustave Flaubert
* Release Date: November 26, 2004 [EBook #14155]
@ -19,13 +19,13 @@ class Text extends \Faker\Provider\Text
* Language: French
*
* *** START OF THIS PROJECT GUTENBERG EBOOK MADAME BOVARY ***
*
*
* Produced by Ebooks libres et gratuits at http://www.ebooksgratuits.com
*
* Gustave Flaubert
* MADAME BOVARY
* (1857)
*
*
* @see http://www.gutenberg.org/cache/epub/14155/pg14155.txt
* @var string
*/
@ -15204,8 +15204,6 @@ EOT;
subject to the trademark license, especially commercial
redistribution.
*** START: FULL LICENSE ***
THE FULL PROJECT GUTENBERG LICENSE
@ -15218,7 +15216,6 @@ EOT;
Gutenberg-tm License (available with this file or online at
http://gutenberg.net/license).
Section 1. General Terms of Use and Redistributing Project Gutenberg-tm
electronic works
@ -15431,7 +15428,6 @@ EOT;
work, (b) alteration, modification, or additions or deletions to any
Project Gutenberg-tm work, and (c) any Defect you cause.
Section 2. Information about the Mission of Project Gutenberg-tm
Project Gutenberg-tm is synonymous with the free distribution of
@ -15476,7 +15472,6 @@ EOT;
Chief Executive and Director
gbnewby@pglaf.org
Section 4. Information about Donations to the Project Gutenberg
Literary Archive Foundation
@ -15511,7 +15506,6 @@ EOT;
ways including including checks, online payments and credit card
donations. To donate, please visit: http://pglaf.org/donate
Section 5. General Information About Project Gutenberg-tm electronic
works.
@ -15520,13 +15514,11 @@ EOT;
with anyone. For thirty years, he produced and distributed Project
Gutenberg-tm eBooks with only a loose network of volunteer support.
Project Gutenberg-tm eBooks are often created from several printed
editions, all of which are confirmed as Public Domain in the U.S.
unless a copyright notice is included. Thus, we do not necessarily
keep eBooks in compliance with any particular paper edition.
Most people start at our Web site which has the main PG search facility:
http://www.gutenberg.net

View File

@ -2580,7 +2580,6 @@ EOT;
Gutenberg, including how to donate, how to help produce our new
eBooks, and how to subscribe to our email newsletter (free!).
Those of you who want to download any eBook before announcement
can get to them as follows, and just download by date. This is
also a good way to get them instantly upon announcement, as the
@ -2595,7 +2594,6 @@ EOT;
Just search by the first five letters of the filename you want,
as it appears in our Newsletters.
Information about Project Gutenberg (one page)
We produce about two million dollars for each hour we work. The
@ -2631,7 +2629,6 @@ EOT;
9000 2003 November*
10000 2004 January*
The Project Gutenberg Literary Archive Foundation has been created
to secure a future for Project Gutenberg into the next millennium.
@ -2694,7 +2691,6 @@ EOT;
http://www.gutenberg.net/donation.html
***
If you can't reach Project Gutenberg,
@ -2866,6 +2862,5 @@ EOT;
*END THE SMALL PRINT! FOR PUBLIC DOMAIN EBOOKS*Ver.02/11/02*END*
*/
}