File tree Expand file tree Collapse file tree 3 files changed +54
-1
lines changed Expand file tree Collapse file tree 3 files changed +54
-1
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,36 @@ public function getResults(): mixed
109109 return $ this ->results ;
110110 }
111111
112+ /**
113+ * Has validator value
114+ *
115+ * @return bool
116+ */
117+ public function hasValue (): bool
118+ {
119+ return ($ this ->value !== null );
120+ }
121+
122+ /**
123+ * Has validator message
124+ *
125+ * @return bool
126+ */
127+ public function hasMessage (): bool
128+ {
129+ return ($ this ->message !== null );
130+ }
131+
132+ /**
133+ * Has validator input
134+ *
135+ * @return bool
136+ */
137+ public function hasInput (): bool
138+ {
139+ return ($ this ->input !== null );
140+ }
141+
112142 /**
113143 * Has validator results
114144 *
Original file line number Diff line number Diff line change @@ -54,6 +54,27 @@ public function getInput(): mixed;
5454 */
5555 public function getResults (): mixed ;
5656
57+ /**
58+ * Has validator value
59+ *
60+ * @return bool
61+ */
62+ public function hasValue (): bool ;
63+
64+ /**
65+ * Has validator message
66+ *
67+ * @return bool
68+ */
69+ public function hasMessage (): bool ;
70+
71+ /**
72+ * Has validator input
73+ *
74+ * @return bool
75+ */
76+ public function hasInput (): bool ;
77+
5778 /**
5879 * Has validator results
5980 *
Original file line number Diff line number Diff line change @@ -15,7 +15,9 @@ public function testAlpha()
1515 $ this ->assertTrue ($ validator ->evaluate ('hello ' ));
1616 $ this ->assertFalse ($ validator ->evaluate (123456 ));
1717 $ this ->assertEquals ('This is not a alphabetical string. ' , $ validator ->getMessage ());
18-
18+ $ this ->assertTrue ($ validator ->hasInput ());
19+ $ this ->assertFalse ($ validator ->hasValue ());
20+ $ this ->assertTrue ($ validator ->hasMessage ());
1921
2022 $ validator = new Validator \Alpha ();
2123 $ this ->assertFalse ($ validator ->evaluate (123456 ));
You can’t perform that action at this time.
0 commit comments