dokuwiki-matrixnotifierwas-plugin – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 <?php
2  
3 namespace MatrixPhp\Exceptions;
4  
5 /**
6 * The home server returned an error response.
7 *
8 * @package MatrixPhp\Exceptions
9 */
10 class MatrixRequestException extends MatrixException {
11  
12 protected $content;
13 public readonly ?string $errCode;
14  
15 public function __construct(int $code = 0, string $content = "") {
16 parent::__construct($content, $code);
17 $this->httpCode = $code;
18 $this->content = $content;
19 try {
20 $decoded = \json_decode($content, TRUE, 512, JSON_THROW_ON_ERROR);
21 $this->errCode = $decoded['errcode'] ?? NULL;
22 }
23 catch (\JsonException) {
24 $this->errCode = NULL;
25 }
26 }
27  
28 /**
29 * @return int
30 */
31 public function getHttpCode(): int {
32 return $this->getCode();
33 }
34  
35 /**
36 * @return string
37 */
38 public function getContent(): string {
39 return $this->content;
40 }
41 }