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