| 1 | <?php |
||
| 16 | class FormError extends AbstractViewHelper |
||
| 17 | { |
||
| 18 | |||
| 19 | /** @var ViewController */ |
||
| 20 | protected $view; |
||
| 21 | |||
| 22 | /** @var string */ |
||
| 23 | protected $field; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Initializing form error helper |
||
| 27 | * |
||
| 28 | * @param ViewController $view |
||
| 29 | * @param string $field |
||
| 30 | * @return $this |
||
| 31 | */ |
||
| 32 | public function __invoke(ViewController $view, string $field) |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Get an error for specific field |
||
| 42 | * |
||
| 43 | * @return string |
||
| 44 | */ |
||
| 45 | public function get() |
||
| 65 | |||
| 66 | /** |
||
| 67 | * Check if a field name has an error |
||
| 68 | * |
||
| 69 | * @return bool |
||
| 70 | */ |
||
| 71 | public function has() |
||
| 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: