DefaultGenerator.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace Faker;
  3. /**
  4. * This generator returns a default value for all called properties
  5. * and methods.
  6. *
  7. * @mixin Generator
  8. *
  9. * @deprecated Use ChanceGenerator instead
  10. */
  11. class DefaultGenerator
  12. {
  13. protected $default;
  14. public function __construct($default = null)
  15. {
  16. trigger_deprecation('fakerphp/faker', '1.16', 'Class "%s" is deprecated, use "%s" instead.', __CLASS__, ChanceGenerator::class);
  17. $this->default = $default;
  18. }
  19. public function ext()
  20. {
  21. return $this;
  22. }
  23. /**
  24. * @param string $attribute
  25. *
  26. * @deprecated Use a method instead.
  27. */
  28. public function __get($attribute)
  29. {
  30. trigger_deprecation('fakerphp/faker', '1.14', 'Accessing property "%s" is deprecated, use "%s()" instead.', $attribute, $attribute);
  31. return $this->default;
  32. }
  33. /**
  34. * @param string $method
  35. * @param array $attributes
  36. */
  37. public function __call($method, $attributes)
  38. {
  39. return $this->default;
  40. }
  41. }