Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 1
<?php
2
 
3
/**
4
 * Slim Framework (https://slimframework.com)
5
 *
6
 * @license https://github.com/slimphp/Slim/blob/4.x/LICENSE.md (MIT License)
7
 */
8
 
9
declare(strict_types=1);
10
 
11
namespace Slim\Exception;
12
 
13
use Psr\Http\Message\ServerRequestInterface;
14
use RuntimeException;
15
use Throwable;
16
 
17
/**
18
 * @method int getCode()
19
 */
20
class HttpException extends RuntimeException
21
{
22
    protected ServerRequestInterface $request;
23
 
24
    protected string $title = '';
25
 
26
    protected string $description = '';
27
 
28
    public function __construct(
29
        ServerRequestInterface $request,
30
        string $message = '',
31
        int $code = 0,
32
        ?Throwable $previous = null
33
    ) {
34
        parent::__construct($message, $code, $previous);
35
        $this->request = $request;
36
    }
37
 
38
    public function getRequest(): ServerRequestInterface
39
    {
40
        return $this->request;
41
    }
42
 
43
    public function getTitle(): string
44
    {
45
        return $this->title;
46
    }
47
 
48
    public function setTitle(string $title): self
49
    {
50
        $this->title = $title;
51
        return $this;
52
    }
53
 
54
    public function getDescription(): string
55
    {
56
        return $this->description;
57
    }
58
 
59
    public function setDescription(string $description): self
60
    {
61
        $this->description = $description;
62
        return $this;
63
    }
64
}