class Payment extends Payment

Properties

static $expirationDateFormat from Payment

Methods

__construct( Generator $generator)

No description

from Base
static  integer
randomDigit()

Returns a random number between 0 and 9

from Base
static  integer
randomDigitNotNull()

Returns a random number between 1 and 9

from Base
static  int
randomDigitNot( int $except)

Generates a random digit, which cannot be $except

from Base
static  integer
randomNumber( integer $nbDigits = null, boolean $strict = false)

Returns a random integer with 0 to $nbDigits digits.

from Base
static  float
randomFloat( int $nbMaxDecimals = null, int|float $min, int|float $max = null)

Return a random float number

from Base
static  integer
numberBetween( integer $int1, integer $int2 = 2147483647)

Returns a random number between $int1 and $int2 (any order)

from Base
static  string
randomLetter()

Returns a random letter from a to z

from Base
static 
randomAscii()

Returns a random ASCII character (excluding accents and special chars)

from Base
static  array
randomElements( array $array = array('a', 'b', 'c'), integer $count = 1, boolean $allowDuplicates = false)

Returns randomly ordered subsequence of $count elements from a provided array

from Base
static  mixed
randomElement( array $array = array('a', 'b', 'c'))

Returns a random element from a passed array

from Base
static  int|string|null
randomKey( array $array = array())

Returns a random key from a passed associative array

from Base
static  array|string
shuffle( array|string $arg = '')

Returns a shuffled version of the argument.

from Base
static  array
shuffleArray( array $array = array())

Returns a shuffled version of the array.

from Base
static  string
shuffleString( string $string = '', string $encoding = 'UTF-8')

Returns a shuffled version of the string.

from Base
static  string
numerify( string $string = '###')

Replaces all hash sign ('#') occurrences with a random number Replaces all percentage sign ('%') occurrences with a not null number

from Base
static  string
lexify( string $string = '????')

Replaces all question mark ('?') occurrences with a random letter

from Base
static  string
bothify( string $string = '## ??')

Replaces hash signs ('#') and question marks ('?') with random numbers and letters An asterisk ('*') is replaced with either a random number or a random letter

from Base
static  string
asciify( string $string = '****')

Replaces * signs with random numbers and letters and special characters

from Base
static  string
regexify( string $regex = '')

Transforms a basic regular expression into a random string satisfying the expression.

from Base
static  string
toLower( string $string = '')

Converts string to lowercase.

from Base
static  string
toUpper( string $string = '')

Converts string to uppercase.

from Base
mixed|null
optional($weight = 0.5, $default = null)

Chainable method for making any formatter optional.

from Base
unique( boolean $reset = false, integer $maxRetries = 10000)

Chainable method for making any formatter unique.

from Base
valid( Closure $validator = null, integer $maxRetries = 10000)

Chainable method for forcing any formatter to return only valid values.

from Base
static  string
creditCardType()

No description

from Payment
static  string
creditCardNumber( string $type = null, boolean $formatted = false, string $separator = '-')

Returns the String of a credit card number.

from Payment
creditCardExpirationDate( boolean $valid = true)

No description

from Payment
string
creditCardExpirationDateString( boolean $valid = true, string $expirationDateFormat = null)

No description

from Payment
array
creditCardDetails( boolean $valid = true)

No description

from Payment
static  string
iban( string $countryCode, string $prefix = '', integer $length = null)

International Bank Account Number (IBAN)

from Payment
static  string
swiftBicNumber()

Return the String of a SWIFT/BIC number

from Payment
string
vat( bool $spacedNationalPrefix = true)

Value Added Tax (VAT)

static  string
bankAccountNumber( string $prefix = '', string $countryCode = 'FR', integer $length = null)

International Bank Account Number (IBAN)

Details

__construct( Generator $generator)

Parameters

Generator $generator

static integer randomDigit()

Returns a random number between 0 and 9

Return Value

integer

static integer randomDigitNotNull()

Returns a random number between 1 and 9

Return Value

integer

static int randomDigitNot( int $except)

Generates a random digit, which cannot be $except

Parameters

int $except

Return Value

int

static integer randomNumber( integer $nbDigits = null, boolean $strict = false)

Returns a random integer with 0 to $nbDigits digits.

The maximum value returned is mt_getrandmax()

Parameters

integer $nbDigits Defaults to a random number between 1 and 9
boolean $strict Whether the returned number should have exactly $nbDigits

Return Value

integer

static float randomFloat( int $nbMaxDecimals = null, int|float $min, int|float $max = null)

Return a random float number

Parameters

int $nbMaxDecimals
int|float $min
int|float $max

Return Value

float

static integer numberBetween( integer $int1, integer $int2 = 2147483647)

Returns a random number between $int1 and $int2 (any order)

Parameters

integer $int1 default to 0
integer $int2 defaults to 32 bit max integer, ie 2147483647

Return Value

integer

static string randomLetter()

Returns a random letter from a to z

Return Value

string

static randomAscii()

Returns a random ASCII character (excluding accents and special chars)

static array randomElements( array $array = array('a', 'b', 'c'), integer $count = 1, boolean $allowDuplicates = false)

Returns randomly ordered subsequence of $count elements from a provided array

Parameters

array $array Array to take elements from. Defaults to a-f
integer $count Number of elements to take.
boolean $allowDuplicates Allow elements to be picked several times. Defaults to false

Return Value

array New array with $count elements from $array

Exceptions

LengthException When requesting more elements than provided

static mixed randomElement( array $array = array('a', 'b', 'c'))

Returns a random element from a passed array

Parameters

array $array

Return Value

mixed

static int|string|null randomKey( array $array = array())

Returns a random key from a passed associative array

Parameters

array $array

Return Value

int|string|null

static array|string shuffle( array|string $arg = '')

Returns a shuffled version of the argument.

This function accepts either an array, or a string.

Parameters

array|string $arg The set to shuffle

Return Value

array|string The shuffled set

See also

shuffleArray()
shuffleString()

static array shuffleArray( array $array = array())

Returns a shuffled version of the array.

This function does not mutate the original array. It uses the Fisher–Yates algorithm, which is unbiased, together with a Mersenne twister random generator. This function is therefore more random than PHP's shuffle() function, and it is seedable.

Parameters

array $array The set to shuffle

Return Value

array The shuffled set

static string shuffleString( string $string = '', string $encoding = 'UTF-8')

Returns a shuffled version of the string.

This function does not mutate the original string. It uses the Fisher–Yates algorithm, which is unbiased, together with a Mersenne twister random generator. This function is therefore more random than PHP's shuffle() function, and it is seedable. Additionally, it is UTF8 safe if the mb extension is available.

Parameters

string $string The set to shuffle
string $encoding The string encoding (defaults to UTF-8)

Return Value

string The shuffled set

static string numerify( string $string = '###')

Replaces all hash sign ('#') occurrences with a random number Replaces all percentage sign ('%') occurrences with a not null number

Parameters

string $string String that needs to bet parsed

Return Value

string

static string lexify( string $string = '????')

Replaces all question mark ('?') occurrences with a random letter

Parameters

string $string String that needs to bet parsed

Return Value

string

static string bothify( string $string = '## ??')

Replaces hash signs ('#') and question marks ('?') with random numbers and letters An asterisk ('*') is replaced with either a random number or a random letter

Parameters

string $string String that needs to bet parsed

Return Value

string

static string asciify( string $string = '****')

Replaces * signs with random numbers and letters and special characters

Parameters

string $string String that needs to bet parsed

Return Value

string

static string regexify( string $regex = '')

Transforms a basic regular expression into a random string satisfying the expression.

Parameters

string $regex A regular expression (delimiters are optional)

Return Value

string

See also

https://github.com/icomefromthenet/ReverseRegex for a more robust implementation

static string toLower( string $string = '')

Converts string to lowercase.

Uses mb_string extension if available.

Parameters

string $string String that should be converted to lowercase

Return Value

string

static string toUpper( string $string = '')

Converts string to uppercase.

Uses mb_string extension if available.

Parameters

string $string String that should be converted to uppercase

Return Value

string

mixed|null optional($weight = 0.5, $default = null)

Chainable method for making any formatter optional.

Parameters

$weight
$default

Return Value

mixed|null

UniqueGenerator unique( boolean $reset = false, integer $maxRetries = 10000)

Chainable method for making any formatter unique.

// will never return twice the same value $faker->unique()->randomElement(array(1, 2, 3));

Parameters

boolean $reset If set to true, resets the list of existing values
integer $maxRetries Maximum number of retries to find a unique value, After which an OverflowException is thrown.

Return Value

UniqueGenerator A proxy class returning only non-existing values

Exceptions

OverflowException When no unique value can be found by iterating $maxRetries times

ValidGenerator valid( Closure $validator = null, integer $maxRetries = 10000)

Chainable method for forcing any formatter to return only valid values.

The value validity is determined by a function passed as first argument.

$values = array(); $evenValidator = function ($digit) { return $digit % 2 === 0; }; for ($i=0; $i < 10; $i++) { $values []= $faker->valid($evenValidator)->randomDigit; } print_r($values); // [0, 4, 8, 4, 2, 6, 0, 8, 8, 6]

Parameters

Closure $validator A function returning true for valid values
integer $maxRetries Maximum number of retries to find a unique value, After which an OverflowException is thrown.

Return Value

ValidGenerator A proxy class returning only valid values

Exceptions

OverflowException When no valid value can be found by iterating $maxRetries times

static string creditCardType()

Return Value

string Returns a credit card vendor name

static string creditCardNumber( string $type = null, boolean $formatted = false, string $separator = '-')

Returns the String of a credit card number.

Parameters

string $type Supporting any of 'Visa', 'MasterCard', 'American Express', and 'Discover'
boolean $formatted Set to true if the output string should contain one separator every 4 digits
string $separator Separator string for formatting card number. Defaults to dash (-).

Return Value

string

DateTime creditCardExpirationDate( boolean $valid = true)

Parameters

boolean $valid True (by default) to get a valid expiration date, false to get a maybe valid date

Return Value

DateTime

string creditCardExpirationDateString( boolean $valid = true, string $expirationDateFormat = null)

Parameters

boolean $valid True (by default) to get a valid expiration date, false to get a maybe valid date
string $expirationDateFormat

Return Value

string

array creditCardDetails( boolean $valid = true)

Parameters

boolean $valid True (by default) to get a valid expiration date, false to get a maybe valid date

Return Value

array

static string iban( string $countryCode, string $prefix = '', integer $length = null)

International Bank Account Number (IBAN)

Parameters

string $countryCode ISO 3166-1 alpha-2 country code
string $prefix for generating bank account number of a specific bank
integer $length total length without country code and 2 check digits

Return Value

string

static string swiftBicNumber()

Return the String of a SWIFT/BIC number

Return Value

string Swift/Bic number

string vat( bool $spacedNationalPrefix = true)

Value Added Tax (VAT)

Parameters

bool $spacedNationalPrefix

Return Value

string VAT Number

See also

http://ec.europa.eu/taxation_customs/vies/faq.html?locale=en#item_11
http://www.iecomputersystems.com/ordering/eu_vat_numbers.htm
http://en.wikipedia.org/wiki/VAT_identification_number

static string bankAccountNumber( string $prefix = '', string $countryCode = 'FR', integer $length = null)

International Bank Account Number (IBAN)

Parameters

string $prefix for generating bank account number of a specific bank
string $countryCode ISO 3166-1 alpha-2 country code
integer $length total length without country code and 2 check digits

Return Value

string