File tree Expand file tree Collapse file tree 2 files changed +33
-8
lines changed
Expand file tree Collapse file tree 2 files changed +33
-8
lines changed Original file line number Diff line number Diff line change @@ -22,17 +22,36 @@ class AlertifyNotifier
2222 */
2323 private $ session ;
2424
25+ /**
26+ * AlertifyNotifier constructor.
27+ *
28+ * @param Store $session
29+ */
2530 public function __construct (Store $ session )
2631 {
2732 $ this ->session = $ session ;
2833 }
2934
30- public function flash ()
35+ /**
36+ * Saves a flash to the session
37+ *
38+ * @return void
39+ */
40+ public function flash (): void
3141 {
3242 $ this ->session ->flash ('odannyc.alertify.logs ' , $ this ->logs );
3343 }
3444
35- public function __call ($ name , $ arguments )
45+ /**
46+ * Any request that comes in gets stored as a log
47+ * and then the log gets returned
48+ *
49+ * @param $name
50+ * @param $arguments
51+ *
52+ * @return Log
53+ */
54+ public function __call ($ name , $ arguments ): Log
3655 {
3756 $ log = new Log ();
3857 $ this ->logs [] = $ log ;
Original file line number Diff line number Diff line change @@ -52,9 +52,11 @@ class Log
5252 * @param string $message The standard alert
5353 * @return Log
5454 */
55- public function standard (string $ message ): Log
55+ public function standard (? string $ message = null ): Log
5656 {
57- $ this ->message = $ message ;
57+ if (!is_null ($ message )) {
58+ $ this ->message = $ message ;
59+ }
5860 $ this ->type = 'log ' ;
5961 Alertify::flash ();
6062 return $ this ;
@@ -66,9 +68,11 @@ public function standard(string $message): Log
6668 * @param string $message The success message
6769 * @return Log
6870 */
69- public function success (string $ message ): Log
71+ public function success (? string $ message = null ): Log
7072 {
71- $ this ->message = $ message ;
73+ if (!is_null ($ message )) {
74+ $ this ->message = $ message ;
75+ }
7276 $ this ->type = 'success ' ;
7377 Alertify::flash ();
7478 return $ this ;
@@ -80,9 +84,11 @@ public function success(string $message): Log
8084 * @param string $message The error message
8185 * @return Log
8286 */
83- public function error (string $ message ): Log
87+ public function error (? string $ message = null ): Log
8488 {
85- $ this ->message = $ message ;
89+ if (!is_null ($ message )) {
90+ $ this ->message = $ message ;
91+ }
8692 $ this ->type = 'error ' ;
8793 Alertify::flash ();
8894 return $ this ;
You can’t perform that action at this time.
0 commit comments