Integration/HealthIntegration.php
private function getIncidents($componentId = null, $unresolvedOnly = true)
    {
        $incidents = [];
        if ($this->isConfigured()) {
            $clientIdKey = $this->getClientIdKey();
            $cacheKey    = 'statuspageIncidents'.$this->keys[$clientIdKey];
            $cacheExpire = 10;
            if (!$incidents = $this->cache->get($cacheKey, $cacheExpire)) {
                $clientSKey = $this->getClientSecretKey();
                $state      = $this->getAuthLoginState();
                $url        = $this->getAuthenticationUrl();
                if ($unresolvedOnly) {
                    $url .= 'pages/'.$this->keys[$clientIdKey].'/incidents/unresolved.json';
                } else {
                    $url .= 'pages/'.$this->keys[$clientIdKey].'/incidents.json';
                }
                $url .= '?api_key='.$this->keys[$clientSKey]
                    .'&response_type=code'
                    .'&state='.$state;
                $incidents = $this->makeRequest($url, ['ignore_event_dispatch' => true]);
                if (is_array($incidents) && count($incidents)) {
                    $this->cache->set($cacheKey, $incidents, $cacheExpire);
                }
            }
        }
        // Narrow down to just the affected component if specified.
        if ($incidents && $componentId) {
            $affected = [];
            foreach ($incidents as $incident) {
                if (!empty($incident['incident_updates'])) {
                    foreach ($incident['incident_updates'] as $update) {
                        if (!empty($update['affected_components'])) {
                            foreach ($update['affected_components'] as $component) {
                                if (!empty($component['code']) && $component['code'] === $componentId) {
                                    $affected[] = $incident;
                                    continue;
                                }
                            }
                        }
                    }
                }
            }
            $incidents = $affected;
        }

        return $incidents;
    }
private function getIncidents($componentId = null, $unresolvedOnly = true)
    {
        $incidents = [];
        if ($this->isConfigured()) {
            $clientIdKey = $this->getClientIdKey();
            $cacheKey    = 'statuspageIncidents'.$this->keys[$clientIdKey];
            $cacheExpire = 10;
            if (!$incidents = $this->cache->get($cacheKey, $cacheExpire)) {
                $clientSKey = $this->getClientSecretKey();
                $state      = $this->getAuthLoginState();
                $url        = $this->getAuthenticationUrl();
                if ($unresolvedOnly) {
                    $url .= 'pages/'.$this->keys[$clientIdKey].'/incidents/unresolved.json';
                } else {
                    $url .= 'pages/'.$this->keys[$clientIdKey].'/incidents.json';
                }
                $url .= '?api_key='.$this->keys[$clientSKey]
                    .'&response_type=code'
                    .'&state='.$state;
                $incidents = $this->makeRequest($url, ['ignore_event_dispatch' => true]);
                if (is_array($incidents) && count($incidents)) {
                    $this->cache->set($cacheKey, $incidents, $cacheExpire);
                }
            }
        }
        // Narrow down to just the affected component if specified.
        if ($incidents && $componentId) {
            $affected = [];
            foreach ($incidents as $incident) {
                if (!empty($incident['incident_updates'])) {
                    foreach ($incident['incident_updates'] as $update) {
                        if (!empty($update['affected_components'])) {
                            foreach ($update['affected_components'] as $component) {
                                if (!empty($component['code']) && $component['code'] === $componentId) {
                                    $affected[] = $incident;
                                    continue;
                                }
                            }
                        }
                    }
                }
            }
            $incidents = $affected;
        }

        return $incidents;
    }
private function getIncidents ( $ componentId = null , $ unresolvedOnly = true ) { $ incidents = [ ] ; if ( $ this -> isConfigured ( ) ) { $ clientIdKey = $ this -> getClientIdKey ( ) ; $ cacheKey = 'statuspageIncidents' . $ this -> keys [ $ clientIdKey ] ; $ cacheExpire = 10 ; if ( ! $ incidents = $ this -> cache -> get ( $ cacheKey , $ cacheExpire ) ) { $ clientSKey = $ this -> getClientSecretKey ( ) ; $ state = $ this -> getAuthLoginState ( ) ; $ url = $ this -> getAuthenticationUrl ( ) ; if ( $ unresolvedOnly ) { $ url .= 'pages/' . $ this -> keys [ $ clientIdKey ] . '/incidents/unresolved.json' ; } else { $ url .= 'pages/' . $ this -> keys [ $ clientIdKey ] . '/incidents.json' ; } $ url .= '?api_key=' . $ this -> keys [ $ clientSKey ] . '&response_type=code' . '&state=' . $ state ; $ incidents = $ this -> makeRequest ( $ url , [ 'ignore_event_dispatch' => true ] ) ; if ( is_array ( $ incidents ) && count ( $ incidents ) ) { $ this -> cache -> set ( $ cacheKey , $ incidents , $ cacheExpire ) ; } } } // Narrow down to just the affected component if specified. if ( $ incidents && $ componentId ) { $ affected = [ ] ; foreach ( $ incidents as $ incident ) { if ( ! empty ( $ incident [ 'incident_updates' ] ) ) { foreach ( $ incident [ 'incident_updates' ] as $ update ) { if ( ! empty ( $ update [ 'affected_components' ] ) ) { foreach ( $ update [ 'affected_components' ] as $ component ) { if ( ! empty ( $ component [ 'code' ] ) && $ component [ 'code' ] === $ componentId ) { $ affected [ ] = $ incident ; continue ; } } } } } } $ incidents = $ affected ; } return $ incidents ; }
Get the list of statuspage active incidents.

@param null $componentId
@param bool $unresolvedOnly

@return array|bool|mixed|string
Get the list of statuspage active incidents .