1
0
mirror of https://github.com/fzaninotto/Faker.git synced 2025-04-04 07:32:42 +02:00

Added phpdoc concerning new formatters (fr_FR)

This commit is contained in:
Geoffrey Brier 2012-06-05 21:49:16 +02:00
parent 1d8e4a79cf
commit b38f633534
2 changed files with 45 additions and 0 deletions

View File

@ -83,25 +83,55 @@ class Address extends \Faker\Provider\Address
return static::randomElement(static::$streetPrefix);
}
/**
* Randomly returns a french region.
*
* @example 'Guadeloupe'
*
* @return string
*/
public static function region()
{
return static::randomElement(static::$regions);
}
/**
* Randomly returns a french department ('departmentNumber' => 'departmentName').
*
* @example array('2B' => 'Haute-Corse')
*
* @return array
*/
public static function department()
{
return static::randomElement(static::$departments);
}
/**
* Randomly returns a french department name.
*
* @example 'Ardèche'
*
* @return string
*/
public static function departmentName()
{
$randomDepartmentName = array_values(static::department());
return $randomDepartmentName[0];
}
/**
* Randomly returns a french department number.
*
* @example '59'
*
* @return string
*/
public static function departmentNumber()
{
$randomDepartmentNumber = array_keys(static::department());
return $randomDepartmentNumber[0];
}
}

View File

@ -15,6 +15,16 @@ class Company extends \Faker\Provider\Company
protected static $sirenFormat = "### ### ###";
/**
* Generates a siret number (14 digits).
* It is in fact the result of the concatenation of a siren number (9 digits),
* a sequential number (4 digits) and a control number (1 digit) concatenation.
* If $maxSequentialDigits is invalid, it is set to 2.
*
* @param int $maxSequentialDigits The maximum number of digits for the sequential number (> 0 && <= 4).
*
* @return string
*/
public static function siret($maxSequentialDigits = 2)
{
if ($maxSequentialDigits > 4 || $maxSequentialDigits <= 0) {
@ -26,6 +36,11 @@ class Company extends \Faker\Provider\Company
return static::numerify(static::siren() . ' ' . $sequentialNumber . '#');
}
/**
* Generates a siren number (9 digits).
*
* @return string
*/
public static function siren()
{
return static::numerify(static::$sirenFormat);