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\Interfaces;
12
 
13
use Psr\Http\Message\ResponseInterface;
14
use Psr\Http\Message\ServerRequestInterface;
15
use Psr\Http\Server\MiddlewareInterface;
16
 
17
interface RouteInterface
18
{
19
    /**
20
     * Get route invocation strategy
21
     */
22
    public function getInvocationStrategy(): InvocationStrategyInterface;
23
 
24
    /**
25
     * Set route invocation strategy
26
     */
27
    public function setInvocationStrategy(InvocationStrategyInterface $invocationStrategy): RouteInterface;
28
 
29
    /**
30
     * Get route methods
31
     *
32
     * @return string[]
33
     */
34
    public function getMethods(): array;
35
 
36
    /**
37
     * Get route pattern
38
     */
39
    public function getPattern(): string;
40
 
41
    /**
42
     * Set route pattern
43
     */
44
    public function setPattern(string $pattern): RouteInterface;
45
 
46
    /**
47
     * Get route callable
48
     *
49
     * @return callable|string
50
     */
51
    public function getCallable();
52
 
53
    /**
54
     * Set route callable
55
     *
56
     * @param callable|string $callable
57
     */
58
    public function setCallable($callable): RouteInterface;
59
 
60
    /**
61
     * Get route name
62
     */
63
    public function getName(): ?string;
64
 
65
    /**
66
     * Set route name
67
     *
68
     * @return static
69
     */
70
    public function setName(string $name): RouteInterface;
71
 
72
    /**
73
     * Get the route's unique identifier
74
     */
75
    public function getIdentifier(): string;
76
 
77
    /**
78
     * Retrieve a specific route argument
79
     */
80
    public function getArgument(string $name, ?string $default = null): ?string;
81
 
82
    /**
83
     * Get route arguments
84
     *
85
     * @return array<string, string>
86
     */
87
    public function getArguments(): array;
88
 
89
    /**
90
     * Set a route argument
91
     */
92
    public function setArgument(string $name, string $value): RouteInterface;
93
 
94
    /**
95
     * Replace route arguments
96
     *
97
     * @param array<string, string> $arguments
98
     */
99
    public function setArguments(array $arguments): self;
100
 
101
    /**
102
     * @param MiddlewareInterface|string|callable $middleware
103
     */
104
    public function add($middleware): self;
105
 
106
    public function addMiddleware(MiddlewareInterface $middleware): self;
107
 
108
    /**
109
     * Prepare the route for use
110
     *
111
     * @param array<string, string> $arguments
112
     */
113
    public function prepare(array $arguments): self;
114
 
115
    /**
116
     * Run route
117
     *
118
     * This method traverses the middleware stack, including the route's callable
119
     * and captures the resultant HTTP response object. It then sends the response
120
     * back to the Application.
121
     */
122
    public function run(ServerRequestInterface $request): ResponseInterface;
123
}