You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 line
863B

  1. <?php
  2. namespace common\components;
  3. use Faker\Factory;
  4. use Faker\Generator;
  5. use Faker\Provider\fr_FR\Address;
  6. use Faker\Provider\fr_FR\Person;
  7. use Faker\Provider\fr_FR\PhoneNumber;
  8. class Faker
  9. {
  10. protected Generator $faker;
  11. public function __construct()
  12. {
  13. $this->faker = Factory::create();
  14. $this->faker->addProvider(new Person($this->faker));
  15. $this->faker->addProvider(new PhoneNumber($this->faker));
  16. $this->faker->addProvider(new Address($this->faker));
  17. }
  18. public function name(): string
  19. {
  20. return $this->faker->name;
  21. }
  22. public function email(): string
  23. {
  24. return $this->faker->email;
  25. }
  26. public function phoneNumber(): string
  27. {
  28. return $this->faker->mobileNumber;
  29. }
  30. public function address(): string
  31. {
  32. return $this->faker->address;
  33. }
  34. }