Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

minor update #719

Merged
merged 2 commits into from
Oct 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Faker/DefaultGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
class DefaultGenerator
{
protected $default = null;
protected $default;

public function __construct($default = null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Faker/Provider/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Faker\Provider;

class Address extends \Faker\Provider\Base
class Address extends Base
{
protected static $citySuffix = array('Ville');
protected static $streetSuffix = array('Street');
Expand Down
12 changes: 6 additions & 6 deletions src/Faker/Provider/Barcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
* @see http://en.wikipedia.org/wiki/EAN-13
* @see http://en.wikipedia.org/wiki/ISBN
*/
class Barcode extends \Faker\Provider\Base
class Barcode extends Base
{
private function ean($length = 13)
{
$code = $this->numerify(str_repeat('#', $length - 1));
$code = static::numerify(str_repeat('#', $length - 1));

return $code . static::eanChecksum($code);
}
Expand All @@ -20,7 +20,7 @@ private function ean($length = 13)
*/
protected static function eanChecksum($input)
{
$sequence = (strlen($input) - 1) == 8 ? array(3, 1) : array(1, 3);
$sequence = (strlen($input) - 1) === 8 ? array(3, 1) : array(1, 3);
$sums = 0;
foreach (str_split($input) as $n => $digit) {
$sums += $digit * $sequence[$n % 2];
Expand All @@ -43,7 +43,7 @@ protected static function isbnChecksum($input)
// so, the length of the input should be 9
$length = 9;

if (strlen($input) != $length) {
if (strlen($input) !== $length) {
throw new \LengthException(sprintf('Input length should be equal to %d', $length));
}

Expand Down Expand Up @@ -89,7 +89,7 @@ public function ean8()
*/
public function isbn10()
{
$code = $this->numerify(str_repeat('#', 9));
$code = static::numerify(str_repeat('#', 9));

return $code . static::isbnChecksum($code);
}
Expand All @@ -103,7 +103,7 @@ public function isbn10()
*/
public function isbn13()
{
$code = '97' . static::numberBetween(8, 9) . $this->numerify(str_repeat('#', 9));
$code = '97' . static::numberBetween(8, 9) . static::numerify(str_repeat('#', 9));

return $code . static::eanChecksum($code);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Faker/Provider/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public static function shuffleString($string = '', $encoding = 'UTF-8')
} else {
$array = str_split($string, 1);
}
return join('', static::shuffleArray($array));
return implode('', static::shuffleArray($array));
}

private static function replaceWildcard($string, $wildcard = '#', $callback = 'static::randomDigit')
Expand Down Expand Up @@ -462,7 +462,7 @@ public static function regexify($regex = '')
// All A-F inside of [] become ABCDEF
$regex = preg_replace_callback('/\[([^\]]+)\]/', function ($matches) {
return '[' . preg_replace_callback('/(\w|\d)\-(\w|\d)/', function ($range) {
return join(range($range[1], $range[2]), '');
return implode(range($range[1], $range[2]), '');
}, $matches[1]) . ']';
}, $regex);
// All [ABC] become B (or A or C)
Expand Down
2 changes: 1 addition & 1 deletion src/Faker/Provider/Biased.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Faker\Provider;

class Biased extends \Faker\Provider\Base
class Biased extends Base
{
/**
* Returns a biased integer between $min and $max (both inclusive).
Expand Down
2 changes: 1 addition & 1 deletion src/Faker/Provider/Company.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Faker\Provider;

class Company extends \Faker\Provider\Base
class Company extends Base
{
protected static $formats = array(
'{{lastName}} {{companySuffix}}',
Expand Down
2 changes: 1 addition & 1 deletion src/Faker/Provider/DateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Faker\Provider;

class DateTime extends \Faker\Provider\Base
class DateTime extends Base
{
protected static $century = array('I','II','III','IV','V','VI','VII','VIII','IX','X','XI','XII','XIII','XIV','XV','XVI','XVII','XVIII','XIX','XX','XXI');

Expand Down
2 changes: 1 addition & 1 deletion src/Faker/Provider/File.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Faker\Provider;

class File extends \Faker\Provider\Base
class File extends Base
{

/**
Expand Down
14 changes: 7 additions & 7 deletions src/Faker/Provider/Lorem.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Faker\Provider;

class Lorem extends \Faker\Provider\Base
class Lorem extends Base
{
protected static $wordList = array(
'alias', 'consequatur', 'aut', 'perferendis', 'sit', 'voluptatem',
Expand Down Expand Up @@ -68,7 +68,7 @@ public static function words($nb = 3, $asText = false)
$words []= static::word();
}

return $asText ? join(' ', $words) : $words;
return $asText ? implode(' ', $words) : $words;
}

/**
Expand All @@ -92,7 +92,7 @@ public static function sentence($nbWords = 6, $variableNbWords = true)
$words = static::words($nbWords);
$words[0] = ucwords($words[0]);

return join($words, ' ') . '.';
return implode($words, ' ') . '.';
}

/**
Expand All @@ -110,7 +110,7 @@ public static function sentences($nb = 3, $asText = false)
$sentences []= static::sentence();
}

return $asText ? join(' ', $sentences) : $sentences;
return $asText ? implode(' ', $sentences) : $sentences;
}

/**
Expand All @@ -131,7 +131,7 @@ public static function paragraph($nbSentences = 3, $variableNbSentences = true)
$nbSentences = self::randomizeNbElements($nbSentences);
}

return join(static::sentences($nbSentences), ' ');
return implode(static::sentences($nbSentences), ' ');
}

/**
Expand All @@ -149,7 +149,7 @@ public static function paragraphs($nb = 3, $asText = false)
$paragraphs []= static::paragraph();
}

return $asText ? join("\n\n", $paragraphs) : $paragraphs;
return $asText ? implode("\n\n", $paragraphs) : $paragraphs;
}

/**
Expand Down Expand Up @@ -205,7 +205,7 @@ public static function text($maxNbChars = 200)
}
}

return join($text, '');
return implode($text, '');
}

protected static function randomizeNbElements($nbElements)
Expand Down
4 changes: 2 additions & 2 deletions src/Faker/Provider/Miscellaneous.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Faker\Provider;

class Miscellaneous extends \Faker\Provider\Base
class Miscellaneous extends Base
{
protected static $languageCode = array('cn', 'de', 'en', 'es', 'fr', 'it', 'pt', 'ru');

Expand Down Expand Up @@ -186,7 +186,7 @@ class Miscellaneous extends \Faker\Provider\Base
*/
public static function boolean($chanceOfGettingTrue = 50)
{
return mt_rand(1, 100) <= $chanceOfGettingTrue ? true : false;
return mt_rand(1, 100) <= $chanceOfGettingTrue;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Faker/Provider/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Faker\Provider;

class Person extends \Faker\Provider\Base
class Person extends Base
{
const GENDER_MALE = 'male';
const GENDER_FEMALE = 'female';
Expand Down
2 changes: 1 addition & 1 deletion src/Faker/Provider/PhoneNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Faker\Provider;

class PhoneNumber extends \Faker\Provider\Base
class PhoneNumber extends Base
{
protected static $formats = array('###-###-###');

Expand Down
4 changes: 2 additions & 2 deletions src/Faker/Provider/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace Faker\Provider;

abstract class Text extends \Faker\Provider\Base
abstract class Text extends Base
{
protected static $baseText = '';
protected static $separator = ' ';
protected static $separatorLen = 1;
protected $explodedText = null;
protected $explodedText;
protected $consecutiveWords = array();

/**
Expand Down
8 changes: 6 additions & 2 deletions src/Faker/Provider/UserAgent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

namespace Faker\Provider;

class UserAgent extends \Faker\Provider\Base
class UserAgent extends Base
{
protected static $userAgents = array('firefox', 'chrome', 'internetExplorer', 'opera', 'safari');

protected static $windowsPlatformTokens = array('Windows NT 6.2', 'Windows NT 6.1', 'Windows NT 6.0', 'Windows NT 5.2', 'Windows NT 5.1', 'Windows NT 5.01', 'Windows NT 5.0', 'Windows NT 4.0', 'Windows 98; Win 9x 4.90', 'Windows 98', 'Windows 95', 'Windows CE');
protected static $windowsPlatformTokens = array(
'Windows NT 6.2', 'Windows NT 6.1', 'Windows NT 6.0', 'Windows NT 5.2', 'Windows NT 5.1',
'Windows NT 5.01', 'Windows NT 5.0', 'Windows NT 4.0', 'Windows 98; Win 9x 4.90', 'Windows 98',
'Windows 95', 'Windows CE'
);

/**
* Possible processors on Linux
Expand Down
2 changes: 1 addition & 1 deletion src/Faker/Provider/Uuid.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Faker\Provider;

class Uuid extends \Faker\Provider\Base
class Uuid extends Base
{
/**
* Generate name based md5 UUID (version 3).
Expand Down
3 changes: 2 additions & 1 deletion src/Faker/Provider/lv_LV/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Faker\Provider\lv_LV;

use Faker\Calculator\Luhn;
use Faker\Provider\DateTime;

class Person extends \Faker\Provider\Person
{
Expand Down Expand Up @@ -70,7 +71,7 @@ public function passportNumber()
public function personalIdentityNumber(\DateTime $birthdate = null)
{
if (!$birthdate) {
$birthdate = \Faker\Provider\DateTime::dateTimeThisCentury();
$birthdate = DateTime::dateTimeThisCentury();
}

$datePart = $birthdate->format('dmy');
Expand Down