| 1 | <?php |
||
| 20 | class Randval implements RandvalInterface |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * |
||
| 24 | * An object to intercept PHP function calls; this makes testing easier. |
||
| 25 | * |
||
| 26 | * @var Phpfunc |
||
| 27 | * |
||
| 28 | */ |
||
| 29 | protected $phpfunc; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * |
||
| 33 | * Constructor. |
||
| 34 | * |
||
| 35 | * @param Phpfunc $phpfunc An object to intercept PHP function calls; |
||
| 36 | * this makes testing easier. |
||
| 37 | * |
||
| 38 | */ |
||
| 39 | 38 | public function __construct(Phpfunc $phpfunc) |
|
| 43 | |||
| 44 | /** |
||
| 45 | * |
||
| 46 | * Returns a cryptographically secure random value. |
||
| 47 | * |
||
| 48 | * @return string |
||
| 49 | * |
||
| 50 | * @throws Exception if neither openssl nor mcrypt is available. |
||
| 51 | * |
||
| 52 | */ |
||
| 53 | 4 | public function generate() |
|
| 75 | } |
||
| 76 |
If you implement
__calland you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__callis implemented by a parent class and only the child class knows which methods exist: