| 1 |
<?php |
| 2 |
|
| 3 |
namespace Give\TestData\Framework\Provider; |
| 4 |
|
| 5 |
class RandomCurrency extends RandomProvider { |
| 6 |
|
| 7 |
/** @var array [currencyCode, ... ] */ |
| 8 |
protected $currencies = [ |
| 9 |
'EUR', |
| 10 |
'CAD', |
| 11 |
'USD', |
| 12 |
]; |
| 13 |
|
| 14 |
public function __invoke() { |
| 15 |
$count = count( $this->currencies ); |
| 16 |
$index = $this->faker->biasedNumberBetween( 0, $count - 1, $function = 'sqrt' ); |
| 17 |
|
| 18 |
return $this->currencies[ $index ]; |
| 19 |
} |
| 20 |
} |
| 21 |
|