Passed
Push — master ( 8dcc68...34e8da )
by
unknown
23:44 queued 20:40
created

ZPushException::showLegalNotice()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
/*
3
 * SPDX-License-Identifier: AGPL-3.0-only
4
 * SPDX-FileCopyrightText: Copyright 2007-2016 Zarafa Deutschland GmbH
5
 * SPDX-FileCopyrightText: Copyright 2020-2022 grommunio GmbH
6
 *
7
 * Main grommunio-sync exception
8
 */
9
10
class ZPushException extends Exception {
11
    protected $defaultLogLevel = LOGLEVEL_FATAL;
12
    protected $httpReturnCode = HTTP_CODE_500;
13
    protected $httpReturnMessage = "Internal Server Error";
14
    protected $httpHeaders = array();
15
    protected $showLegal = true;
16
17
    public function __construct($message = "", $code = 0, $previous = NULL, $logLevel = false) {
18
        if (! $message)
19
            $message = $this->httpReturnMessage;
20
21
        if (!$logLevel)
22
            $logLevel = $this->defaultLogLevel;
23
24
        parent::__construct($message, (int) $code);
25
        ZLog::Write($logLevel, get_class($this) .': '. $message . ' - code: '.$code. ' - file: '. $this->getFile().':'.$this->getLine(), false);
26
    }
27
28
    public function getHTTPCodeString() {
29
        return $this->httpReturnCode . " ". $this->httpReturnMessage;
30
    }
31
32
    public function getHTTPHeaders() {
33
        return $this->httpHeaders;
34
    }
35
36
    public function showLegalNotice() {
37
        return $this->showLegal;
38
    }
39
}
40