Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
50.00% |
1 / 2 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| DurationFaker | |
50.00% |
1 / 2 |
|
50.00% |
1 / 2 |
2.50 | |
0.00% |
0 / 1 |
| supports | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| fakeFor | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | namespace Apie\Faker\Fakers; |
| 3 | |
| 4 | use Apie\Faker\Interfaces\ApieClassFaker; |
| 5 | use Faker\Generator; |
| 6 | use ReflectionClass; |
| 7 | use Time\Duration; |
| 8 | |
| 9 | /** @implements ApieClassFaker<Duration> */ |
| 10 | class DurationFaker implements ApieClassFaker |
| 11 | { |
| 12 | public function supports(ReflectionClass $class): bool |
| 13 | { |
| 14 | return $class->name === Duration::class; |
| 15 | } |
| 16 | |
| 17 | public function fakeFor(Generator $generator, ReflectionClass $class): Duration |
| 18 | { |
| 19 | return Duration::fromSeconds($generator->numberBetween(0, 1000), $generator->numberBetween(0, 999999999)); |
| 20 | } |
| 21 | } |