@@ -58,16 +58,18 @@ public function check()
5858 "responseTime " => $ responseTime ,
5959 ];
6060
61- if (array_key_exists ('connected_clients ' , $ stats )) {
62- $ successInformation ['connections ' ] = (int ) $ stats ['connected_clients ' ];
63- } elseif (array_key_exists ('Clients ' , $ stats ) && array_key_exists ('connected_clients ' , $ stats ['Clients ' ])) {
64- $ successInformation ['connections ' ] = (int ) $ stats ['Clients ' ]['connected_clients ' ];
65- }
61+ if (is_array ($ stats )) {
62+ if (array_key_exists ('connected_clients ' , $ stats )) {
63+ $ successInformation ['connections ' ] = (int )$ stats ['connected_clients ' ];
64+ } elseif (array_key_exists ('Clients ' , $ stats ) && array_key_exists ('connected_clients ' , $ stats ['Clients ' ])) {
65+ $ successInformation ['connections ' ] = (int )$ stats ['Clients ' ]['connected_clients ' ];
66+ }
6667
67- if (array_key_exists ('uptime_in_seconds ' , $ stats )) {
68- $ successInformation ['uptime ' ] = (int ) $ stats ['uptime_in_seconds ' ];
69- } elseif (array_key_exists ('Server ' , $ stats ) && array_key_exists ('uptime_in_seconds ' , $ stats ['Server ' ])) {
70- $ successInformation ['uptime ' ] = (int ) $ stats ['Server ' ]['uptime_in_seconds ' ];
68+ if (array_key_exists ('uptime_in_seconds ' , $ stats )) {
69+ $ successInformation ['uptime ' ] = (int )$ stats ['uptime_in_seconds ' ];
70+ } elseif (array_key_exists ('Server ' , $ stats ) && array_key_exists ('uptime_in_seconds ' , $ stats ['Server ' ])) {
71+ $ successInformation ['uptime ' ] = (int )$ stats ['Server ' ]['uptime_in_seconds ' ];
72+ }
7173 }
7274
7375 return new Success (
0 commit comments