Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
6 / 6 |
CRAP | |
100.00% |
1 / 1 |
| RandomizerFromFaker | |
100.00% |
6 / 6 |
|
100.00% |
6 / 6 |
6 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| randomElements | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| randomElement | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| randomDigit | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| numberBetween | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| shuffle | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\Core\Randomizer; |
| 3 | |
| 4 | use Faker\Generator; |
| 5 | |
| 6 | class RandomizerFromFaker implements RandomizerInterface |
| 7 | { |
| 8 | public function __construct(private readonly Generator $generator) |
| 9 | { |
| 10 | } |
| 11 | |
| 12 | public function randomElements(array $elements, int $count): array |
| 13 | { |
| 14 | return $this->generator->randomElements($elements, $count); |
| 15 | } |
| 16 | public function randomElement(array $elements): mixed |
| 17 | { |
| 18 | return $this->generator->randomElement($elements); |
| 19 | } |
| 20 | public function randomDigit(): int |
| 21 | { |
| 22 | return $this->generator->randomDigit(); |
| 23 | } |
| 24 | public function numberBetween(int $minLength, int $maxLength): int |
| 25 | { |
| 26 | return $this->generator->numberBetween($minLength, $maxLength); |
| 27 | } |
| 28 | |
| 29 | public function shuffle(array& $list): void |
| 30 | { |
| 31 | shuffle($list); |
| 32 | } |
| 33 | } |