No Description

DefaultGenerator.php 669B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace Faker;
  3. /**
  4. * This generator returns a default value for all called properties
  5. * and methods. It works with Faker\Generator\Base->optional().
  6. */
  7. class DefaultGenerator
  8. {
  9. protected $default;
  10. public function __construct($default = null)
  11. {
  12. $this->default = $default;
  13. }
  14. /**
  15. * @param string $attribute
  16. *
  17. * @return mixed
  18. */
  19. public function __get($attribute)
  20. {
  21. return $this->default;
  22. }
  23. /**
  24. * @param string $method
  25. * @param array $attributes
  26. *
  27. * @return mixed
  28. */
  29. public function __call($method, $attributes)
  30. {
  31. return $this->default;
  32. }
  33. }