DefaultGenerator.php 613 B

1234567891011121314151617181920212223242526272829303132333435
  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. public function __get($attribute)
  18. {
  19. return $this->default;
  20. }
  21. /**
  22. * @param string $method
  23. * @param array $attributes
  24. */
  25. public function __call($method, $attributes)
  26. {
  27. return $this->default;
  28. }
  29. }