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 function implode;
14
 
15
class HttpMethodNotAllowedException extends HttpSpecializedException
16
{
17
    /**
18
     * @var string[]
19
     */
20
    protected array $allowedMethods = [];
21
 
22
    /**
23
     * @var int
24
     */
25
    protected $code = 405;
26
 
27
    /**
28
     * @var string
29
     */
30
    protected $message = 'Method not allowed.';
31
 
32
    protected string $title = '405 Method Not Allowed';
33
    protected string $description = 'The request method is not supported for the requested resource.';
34
 
35
    /**
36
     * @return string[]
37
     */
38
    public function getAllowedMethods(): array
39
    {
40
        return $this->allowedMethods;
41
    }
42
 
43
    /**
44
     * @param string[] $methods
45
     */
46
    public function setAllowedMethods(array $methods): self
47
    {
48
        $this->allowedMethods = $methods;
49
        $this->message = 'Method not allowed. Must be one of: ' . implode(', ', $methods);
50
        return $this;
51
    }
52
}