GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — supported-php-versions ( b1e0a1 )
by
unknown
03:56
created

SkautisQuery::getExceptionString()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 4
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
crap 6
1
<?php
2
3
namespace Skautis;
4
5
/**
6
 * Trida slouzici pro debugovani SOAP pozadvku na servery Skautisu
7
 */
8
class SkautisQuery implements \Serializable
9
{
10
11
    /**
12
     * @var string Nazev funkce volane pomoci SOAP requestu
13
     */
14
    public $fname;
15
16
    /**
17
     * @var array Parametry SOAP requestu na server
18
     */
19
    public $args;
20
21
    /**
22
     * @var array Zasobnik volanych funkci
23
     */
24
    public $trace;
25
26
    /**
27
     * @var int Doba trvani pozadvku
28
     */
29
    public $time;
30
31
    public $result;
32
33
    /**
34
     * V pripade ze SOAP pozadavek selze
35
     *
36
     * Nelze povolit uzivateli primy pristup kvuli serializaci. Ne vsechny exceptions jdou serializovat.
37
     *
38
     * @var \Exception|null
39
     */
40
    protected $exception = null;
41
42
    /**
43
     * Po unserializaci Query s exception je zde jeji trida
44
     *
45
     * @var string
46
     */
47
    protected $exceptionClass = "";
48
49
    /**
50
     * Po unserializaci je zde text exxception
51
     *
52
     * Pouziva __toString() methodu
53
     *
54
     * @var string
55
     */
56
    protected $exceptionString = "";
57
58
    /**
59
     *
60
     *
61
     * @param string $fname Nazev volane funkce
62
     * @param array  $args  Argumenty pozadavku
63
     * @param string $trace Zasobnik volanych funkci
64
     */
65 4
    public function __construct($fname, array $args = [], array $trace = [])
66
    {
67 4
        $this->fname = $fname;
68 4
        $this->args = $args;
69 4
        $this->trace = $trace;
70 4
        $this->time = -microtime(true);
71 4
    }
72
73 2
    public function serialize()
74
    {
75
        $data = [
76 2
            'fname' => $this->fname,
77 2
            'args' => $this->args,
78 2
            'trace' => $this->trace,
79 2
            'time' => $this->time,
80 2
            'result' => $this->result,
81 2
            'exception_class' => is_null($this->exception) ? "" : get_class($this->exception),
82 2
            'exception_string' => is_null($this->exception) ? "" : (string)$this->exception,
83 2
        ];
84 2
        return serialize($data);
85
    }
86
87 2
    public function unserialize($data)
88
    {
89 2
        $data = unserialize($data);
90 2
        $this->fname = $data['fname'];
91 2
        $this->args = $data['args'];
92 2
        $this->trace = $data['trace'];
93 2
        $this->time = $data['time'];
94 2
        $this->result = $data['result'];
95 2
        $this->exceptionClass = $data['exception_class'];
96 2
        $this->exceptionString = $data['exception_string'];
97 2
    }
98
99
    /**
100
     * Oznac pozadavek za dokonceny a uloz vysledek
101
     *
102
     * @param mixed $result Odpoved ze serveru
103
     * @param \Exception Výjimka v pripade problemu
104
     */
105 4
    public function done($result = null, \Exception $e = null)
106
    {
107 4
        $this->time += microtime(true);
108 4
        $this->result = $result;
109 4
        $this->exception = $e;
110
111 4
        return $this;
112
    }
113
114
    /**
115
     * Vrati tridu exception
116
     *
117
     * Pouziva se tato metoda protoze SoapFault exception vyhozena SoapClientem nejde serializovat
118
     *
119
     * @return string
120
     */
121 3
    public function getExceptionClass()
122
    {
123 3
        if ($this->exception === null) {
124 2
            return $this->exceptionClass;
125
        }
126
127 1
        return get_class($this->exception);
128
    }
129
130
    /**
131
     * Vrati textovou podobu exception
132
     *
133
     * @return string
134
     */
135
    public function getExceptionString()
136
    {
137
        if ($this->exception === null) {
138
            return $this->exceptionString;
139
        }
140
141
        return (string)$this->exception;
142
    }
143
144
    /**
145
     * Kontrola jestli se pozadavek zdaril
146
     *
147
     * @return bool
148
     */
149 4
    public function hasFailed()
150
    {
151 4
        return $this->exception !== null || strlen($this->exceptionClass) > 0;
152
    }
153
}
154