@@ -143,21 +143,27 @@ function parseStatusFeed($feedUrl, $filter = null) {
143143 // Check for resolved/completed keywords which indicate the incident is over
144144 $ isResolved = preg_match ('/\b(resolved|completed|fixed|closed|ended|restored|operational)\b/i ' , $ title );
145145
146+ // If not recent or if resolved, no incident
146147 if (!$ isRecent || $ isResolved ) {
147- // No active incident
148- $ status ['indicator ' ] = 'none ' ;
149- $ status ['description ' ] = 'All Systems Operational ' ;
148+ return [
149+ 'indicator ' => 'none ' ,
150+ 'description ' => 'All Systems Operational '
151+ ];
150152 }
153+
154+ // Check severity of active incident
151155 if (preg_match ('/outage|down|major|critical|offline/i ' , $ fullText )) {
152- // Active incident detected - check severity
153- $ status ['indicator ' ] = 'major ' ;
154- $ status ['description ' ] = 'Major Outage ' ;
155- }
156- if ($ isRecent && !$ isResolved && !preg_match ('/outage|down|major|critical|offline/i ' , $ fullText )) {
157- // Any other active incident is considered minor
158- $ status ['indicator ' ] = 'minor ' ;
159- $ status ['description ' ] = 'Partially Degraded Service ' ;
156+ return [
157+ 'indicator ' => 'major ' ,
158+ 'description ' => 'Major Outage '
159+ ];
160160 }
161+
162+ // Any other active incident is considered minor
163+ return [
164+ 'indicator ' => 'minor ' ,
165+ 'description ' => 'Partially Degraded Service '
166+ ];
161167 }
162168 // Check if it's an RSS feed
163169 elseif (isset ($ xml ->channel ->item )) {
@@ -199,26 +205,27 @@ function parseStatusFeed($feedUrl, $filter = null) {
199205 // Check for resolved/completed keywords which indicate the incident is over
200206 $ isResolved = preg_match ('/\b(resolved|completed|fixed|closed|ended|restored|operational)\b/i ' , $ title );
201207
208+ // If not recent or if resolved, no incident
202209 if (!$ isRecent || $ isResolved ) {
203- // No active incident
204- $ status ['indicator ' ] = 'none ' ;
205- $ status ['description ' ] = 'All Systems Operational ' ;
210+ return [
211+ 'indicator ' => 'none ' ,
212+ 'description ' => 'All Systems Operational '
213+ ];
206214 }
215+
216+ // Check severity of active incident
207217 if (preg_match ('/outage|down|major|critical|offline/i ' , $ fullText )) {
208- // Active incident detected - check severity
209- $ status ['indicator ' ] = 'major ' ;
210- $ status ['description ' ] = 'Major Outage ' ;
218+ return [
219+ 'indicator ' => 'major ' ,
220+ 'description ' => 'Major Outage '
221+ ];
211222 }
212- if ($ isRecent && !$ isResolved && !preg_match ('/outage|down|major|critical|offline/i ' , $ fullText )) {
213- // Any other active incident is considered minor
214- $ status ['indicator ' ] = 'minor ' ;
215- $ status ['description ' ] = 'Partially Degraded Service ' ;
216- }
217- }
218-
219- // Truncate long descriptions
220- if (strlen ($ status ['description ' ]) > 200 ) {
221- $ status ['description ' ] = substr ($ status ['description ' ], 0 , 197 ) . '... ' ;
223+
224+ // Any other active incident is considered minor
225+ return [
226+ 'indicator ' => 'minor ' ,
227+ 'description ' => 'Partially Degraded Service '
228+ ];
222229 }
223230
224231 return $ status ;
0 commit comments