Get listing of all stat alerts using the Alerts API.

@see https://www.stathat.com/manual/alerts_api
@throws \Exception
359184
public function getAlerts()
    {
        if (! isset($this->config['access_token'])) {
            throw new Exception('StatHat Alerts API Access Token not set.');
        }

        $result = $this->curlGet($this->alerts_url.'/x/'.$this->config['access_token'].'/alerts');

        return $result;
    }
717291
public function getNotificationTemplateData() {
		return array(
			'Content'		=> $this->Content,
			'HTMLContent'	=> $this->ConvertedContent(),
			'Title'			=> $this->Title,
			'Link'			=> $this->Link(),
			'AbsoluteLink'	=> $this->AbsoluteLink(),
			'ThreadLink'	=> $this->ThreadLink(),
			'AbsoluteThreadLink'	=> $this->AbsoluteThreadLink(),
		);
	}
1087660
protected function getStatistics() {
        if (!$this->_statistics) {
            $this->_statistics = new TaskStatisticsList(
                $this->version,
                $this->solution['assistantSid'],
                $this->solution['sid']
            );
        }

        return $this->_statistics;
    }
1019418
protected function getMessages()
    {
        $messages = [];
        $path = $this->sourcePath;

        if (!$this->file->exists($path)) {
            throw new \Exception("${path} doesn't exists!");
        }

        foreach ($this->file->allFiles($path) as $file) {
            $pathName = $file->getRelativePathName();
            $extension = $this->file->extension($pathName);
            if ($extension != 'php' && $extension != 'json') {
                continue;
            }

            if ($this->isMessagesExcluded($pathName)) {
                continue;
            }

            $key = substr($pathName, 0, -4);
            $key = str_replace('\\', '.', $key);
            $key = str_replace('/', '.', $key);

            if (starts_with($key, 'vendor')) {
                $key = $this->getVendorKey($key);
            }

            $fullPath = $path.DIRECTORY_SEPARATOR.$pathName;
            if ($extension == 'php') {
                $messages[$key] = include $fullPath;
            } else {
                $key = $key.$this->stringsDomain;
                $fileContent = file_get_contents($fullPath);
                $messages[$key] = json_decode($fileContent, true);
            }
        }

        $this->sortMessages($messages);

        return $messages;
    }
949468
def alerts(self):
        """"""
        endpoint = '/'.join((self.endpoint, self.id, 'alerts'))
        return self.alertFactory.find(
            endpoint=endpoint,
            api_key=self.api_key,
        )
1198208
public function getAlertMessageType()
    {
        // Obtain Base Alert Class:
        
        $classes = $this->styles('alert');
        
        // Determine Message Type:
        
        switch ($this->owner->MessageType) {
            case ValidationResult::TYPE_GOOD:
                $classes[] = $this->style('alert.success');
                break;
            case ValidationResult::TYPE_INFO:
                $classes[] = $this->style('alert.info');
                break;
            case ValidationResult::TYPE_ERROR:
                $classes[] = $this->style('alert.danger');
                break;
            default:
                $classes[] = $this->style('alert.warning');
        }
        
        // Answer Classes:
        
        return ViewTools::singleton()->array2att($classes);
    }
1075257
def alerts(self):
        
        if not self.__alerts:
            self.__alerts = Alerts(self.__connection)
        return self.__alerts
781803
public function extractHeaders(){
        $absoluteUrl = $this->getAbsoluteUrl();
        $headersArrRaw = get_headers($absoluteUrl, 1); 
        
        if($headersArrRaw === false){
            throw new \Exception("cannot get headers for {$absoluteUrl}");
        }
        
        $headersArr = array_change_key_case($headersArrRaw, CASE_LOWER);        
        if(isset($headersArr[0]) === true && strpos($headersArr[0], 'HTTP/') !== false){
            $statusStmt = $headersArr[0];
            $statusParts = explode(' ', $statusStmt);
            $headersArr['status-code'] = $statusParts[1];
            
            $statusIndex = strrpos($statusStmt, $statusParts[1])+ strlen($statusParts[1])+1;
            $headersArr['status'] = trim(substr($statusStmt, $statusIndex));
        }
        if(is_array($headersArr['content-type']) === true){
            $headersArr['content-type'] = end($headersArr['content-type']);
        }
        
        return $headersArr;
    }
635487
public function getStatisticsServices():array
    {

        $services = $this->getAllServices();
        $counter = 0;
        $senable = 0;

        foreach ($services as $val) {
            if ($val->status == "enabled") {
                $senable++;
            }

            $counter++;
        }

        return (array("number" => $counter, "enabled" => $senable));
    }
1347065
public function getStats()
    {
        if (null !== $this->errorStack) {
            throw new \RuntimeException(sprintf(
                'Cannot retrieve stats when an exception was encountered ([%s] %s)',
                $this->errorStack->getTop()->getClass(),
                $this->errorStack->getTop()->getMessage()
            ));
        }

        if (false === $this->computed) {
            throw new \RuntimeException(
                'No statistics have yet been computed for this iteration set (::computeStats should be called)'
            );
        }

        return $this->stats;
    }
997386
public function getStatuses()
    {
        if (!$this->response) {
            $this->response = $this->prepareRequest()->send();
        }

        if (200 !== $this->response->getStatusCode()) {
            throw new \RuntimeException(sprintf('Client faild with "%s". Status: "%s"', $this->feedUrl , $this->response->getStatusCode()));
        }

        $statuses = $this->extractRawStatuses($this->response->getBody());

        foreach ($statuses as $status) {
            $this->statuses[] = $this->createNewStatusInstance($status);
        }

        return $this->statuses;
    }
415604
public function deleteAlert($alert_id)
    {
        if (! isset($this->config['access_token'])) {
            throw new Exception('StatHat Alerts API Access Token not set.');
        }

        $result = $this->curlDelete($this->alerts_url.'/x/'.$this->config['access_token'].'/alerts/'.$alert_id);

        return $result;
    }
364254
public function get_indicators() {
        if ($this->indicators !== null) {
            return $this->indicators;
        }

        $fullclassnames = json_decode($this->model->indicators);

        if (!is_array($fullclassnames)) {
            throw new \coding_exception('Model ' . $this->model->id . ' indicators can not be read');
        }

        $this->indicators = array();
        foreach ($fullclassnames as $fullclassname) {
            $instance = \core_analytics\manager::get_indicator($fullclassname);
            if ($instance) {
                $this->indicators[$fullclassname] = $instance;
            } else {
                debugging('Can\'t load ' . $fullclassname . ' indicator', DEBUG_DEVELOPER);
            }
        }

        return $this->indicators;
    }
310222
protected function getAllAlerts(array $alerts = [])
    {
        foreach ($this->notifiers as $notifier) {
            $alerts = array_merge_recursive($alerts, $notifier->get());
        }

        return $alerts;
    }
1304375
protected function getStats () : array
    {
        if (!$this->_StatsDone) :
            foreach ($this->_Stats['tally'] as &$Roundvalue) :
                foreach ($Roundvalue as $ArcKey => &$Arcvalue) :
                    foreach ($Arcvalue as $key => &$value) :
                        if ($key === 'from' || $key === 'to') :
                            $value = $this->_selfElection->getCandidateId($value, true);
                        endif;
                    endforeach;
                endforeach;
            endforeach;

            foreach ($this->_Stats['arcs'] as $ArcKey => &$Arcvalue) :
                foreach ($Arcvalue as $key => &$value) :
                    if ($key === 'from' || $key === 'to') :
                        $value = $this->_selfElection->getCandidateId($value, true);
                    endif;
                endforeach;
            endforeach;

            $this->_StatsDone = true;
        endif;

        return $this->_Stats;
    }
1193353
private function getExceptionData($exception)
    {
        $data = [];

        $data['enviroment'] = env('APP_ENV');
        $data['host'] = Request::server('SERVER_NAME');
        $data['method'] = Request::method();
        $data['fullUrl'] = Request::fullUrl();
        $data['exception'] = $exception->getMessage();
        $data['error'] = $exception->getTraceAsString();
        $data['line'] = $exception->getLine();
        $data['file'] = $exception->getFile();
        $data['class'] = get_class($exception);
        $data['storage'] = [
            'SERVER' => Request::server(),
            'GET' => Request::query(),
            'POST' => $_POST,
            'FILE' => Request::file(),
            'OLD' => Request::hasSession() ? Request::old() : [],
            'COOKIE' => Request::cookie(),
            'SESSION' => Request::hasSession() ? Session::all() : [],
            'HEADERS' => Request::header(),
        ];

        $data['storage'] = array_filter($data['storage']);

        $count = $this->config['count'];
        $lines = file($data['file']);
        $data['exegutor'] = [];

        for ($i = -1 * abs($count); $i <= abs($count); $i++) {
            $data['exegutor'][] = $this->getLineInfo($lines, $data['line'], $i);
        }
        $data['exegutor'] = array_filter($data['exegutor']);

        // to make symfony exception more readable
        if ($data['class'] == 'Symfony\Component\Debug\Exception\FatalErrorException') {
            preg_match("~^(.+)' in ~", $data['exception'], $matches);
            if (isset($matches[1])) {
                $data['exception'] = $matches[1];
            }
        }

        return $data;
    }
886390
protected function getStatusCodeAndMessage(Throwable $exception): array
	{
		if($exception instanceof HttpException)
		{
			$message = $exception->getMessage();
		}

		if(empty($message))
		{
			$message = 'An error has occurred while processing your request.';
		}

		return ['code' => $this->getStatusCode($exception), 'message' => $message];
	}