1 | <?php |
||
14 | class Failure implements JsonSerializable |
||
15 | { |
||
16 | /** |
||
17 | * The field that failed. |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $field; |
||
22 | |||
23 | /** |
||
24 | * The failure message. |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $message; |
||
29 | |||
30 | /** |
||
31 | * The arguments passed to the rule specification. |
||
32 | * |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $args = array(); |
||
36 | |||
37 | /** |
||
38 | * Constructor. |
||
39 | * |
||
40 | * @param string $field The field that failed. |
||
41 | * @param string $message The failure message. |
||
42 | * @param array $args The arguments passed to the rule specification. |
||
43 | * |
||
44 | * @return self |
||
|
|||
45 | */ |
||
46 | 9 | public function __construct( |
|
55 | |||
56 | /** |
||
57 | * Returns the field that failed. |
||
58 | * |
||
59 | * @return string |
||
60 | */ |
||
61 | 1 | public function getField() |
|
65 | |||
66 | /** |
||
67 | * Returns the failure message. |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | 8 | public function getMessage() |
|
75 | |||
76 | /** |
||
77 | * Returns the arguments passed to the rule specification. |
||
78 | * |
||
79 | * @return array |
||
80 | */ |
||
81 | 1 | public function getArgs() |
|
85 | |||
86 | /** |
||
87 | * Returns an array for json_encode. |
||
88 | * |
||
89 | * @return array |
||
90 | */ |
||
91 | 1 | public function jsonSerialize() |
|
99 | } |
||
100 |
Adding a
@return
annotation 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.