| 1 | <?php |
||
| 20 | class Failure implements JsonSerializable |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * |
||
| 24 | * The field that failed. |
||
| 25 | * |
||
| 26 | * @var string |
||
| 27 | * |
||
| 28 | */ |
||
| 29 | protected $field; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * |
||
| 33 | * The failure message. |
||
| 34 | * |
||
| 35 | * @var string |
||
| 36 | * |
||
| 37 | */ |
||
| 38 | protected $message; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * |
||
| 42 | * The arguments passed to the rule specification. |
||
| 43 | * |
||
| 44 | * @var array |
||
| 45 | * |
||
| 46 | */ |
||
| 47 | protected $args = array(); |
||
| 48 | |||
| 49 | /** |
||
| 50 | * |
||
| 51 | * Constructor. |
||
| 52 | * |
||
| 53 | * @param string $field The field that failed. |
||
| 54 | * |
||
| 55 | * @param string $message The failure message. |
||
| 56 | * |
||
| 57 | * @param array $args The arguments passed to the rule specification. |
||
| 58 | * |
||
| 59 | * @return self |
||
|
|
|||
| 60 | * |
||
| 61 | */ |
||
| 62 | 9 | public function __construct( |
|
| 71 | |||
| 72 | /** |
||
| 73 | * |
||
| 74 | * Returns the field that failed. |
||
| 75 | * |
||
| 76 | * @return string |
||
| 77 | * |
||
| 78 | */ |
||
| 79 | 1 | public function getField() |
|
| 83 | |||
| 84 | /** |
||
| 85 | * |
||
| 86 | * Returns the failure message. |
||
| 87 | * |
||
| 88 | * @return string |
||
| 89 | * |
||
| 90 | */ |
||
| 91 | 8 | public function getMessage() |
|
| 95 | |||
| 96 | /** |
||
| 97 | * |
||
| 98 | * Returns the arguments passed to the rule specification. |
||
| 99 | * |
||
| 100 | * @return array |
||
| 101 | * |
||
| 102 | */ |
||
| 103 | 1 | public function getArgs() |
|
| 107 | |||
| 108 | /** |
||
| 109 | * |
||
| 110 | * Returns an array for json_encode. |
||
| 111 | * |
||
| 112 | * @return array |
||
| 113 | * |
||
| 114 | */ |
||
| 115 | 1 | public function jsonSerialize() |
|
| 123 | } |
||
| 124 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.