Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
PasswordValueObjectFaker | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
supports | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
fakeFor | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | namespace Apie\Faker\Fakers; |
3 | |
4 | use Apie\Core\Randomizer\RandomizerFromFaker; |
5 | use Apie\Core\ValueObjects\Interfaces\ValueObjectInterface; |
6 | use Apie\Core\ValueObjects\IsPasswordValueObject; |
7 | use Apie\Faker\Interfaces\ApieClassFaker; |
8 | use Faker\Generator; |
9 | use ReflectionClass; |
10 | |
11 | /** @implements ApieClassFaker<ValueObjectInterface> */ |
12 | class PasswordValueObjectFaker implements ApieClassFaker |
13 | { |
14 | public function supports(ReflectionClass $class): bool |
15 | { |
16 | return $class->implementsInterface(ValueObjectInterface::class) && in_array(IsPasswordValueObject::class, $class->getTraitNames()); |
17 | } |
18 | |
19 | public function fakeFor(Generator $generator, ReflectionClass $class): ValueObjectInterface |
20 | { |
21 | $className = $class->name; |
22 | return $className::createRandom(new RandomizerFromFaker($generator)); |
23 | } |
24 | } |