Issues (36)

src/RouterInterface.php (1 issue)

Labels
Severity
1
<?php declare(strict_types=1);
2
3
/*
4
 * This file is part of Biurad opensource projects.
5
 *
6
 * @copyright 2019 Biurad Group (https://biurad.com/)
7
 * @license   https://opensource.org/licenses/BSD-3-Clause License
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Flange;
14
15
use Flight\Routing\{RouteCollection, RouteUri};
16
17
/**
18
 * Flight Routing support methods proxied into application class.
19
 *
20
 * @author Divine Niiquaye Ibok <[email protected]>
21
 */
22
interface RouterInterface
23
{
24
    /**
25
     * Attach middleware to the pipeline.
26
     */
27
    public function pipe(object ...$middlewares): void;
28
29
    /**
30
     * Attach a list of grouped middlewares to the pipeline.
31
     */
32
    public function pipes(string $named, object ...$middlewares): void;
33
34
    /**
35
     * Generate a URI from the named route.
36
     *
37
     * @return \Flight\Routing\Generator\GeneratedUri|RouteUri
0 ignored issues
show
The type Flight\Routing\Generator\GeneratedUri was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
38
     */
39
    public function generateUri(string $routeName, array $parameters = []);
40
41
    /**
42
     * Maps a pattern to a callable.
43
     *
44
     * You can optionally specify HTTP methods that should be matched.
45
     *
46
     * @param mixed $to Callback that returns the response when matched
47
     *
48
     * @return \Flight\Routing\Route|RouteCollection
49
     */
50
    public function match(string $pattern, array $methods = ['GET'], mixed $to = null);
51
52
    /**
53
     * Maps a POST request to a callable.
54
     *
55
     * @param mixed $to Callback that returns the response when matched
56
     *
57
     * @return \Flight\Routing\Route|RouteCollection
58
     */
59
    public function post(string $pattern, mixed $to = null);
60
61
    /**
62
     * Maps a PUT request to a callable.
63
     *
64
     * @param mixed $to Callback that returns the response when matched
65
     *
66
     * @return \Flight\Routing\Route|RouteCollection
67
     */
68
    public function put(string $pattern, mixed $to = null);
69
70
    /**
71
     * Maps a DELETE request to a callable.
72
     *
73
     * @param mixed $to Callback that returns the response when matched
74
     *
75
     * @return \Flight\Routing\Route|RouteCollection
76
     */
77
    public function delete(string $pattern, mixed $to = null);
78
79
    /**
80
     * Maps an OPTIONS request to a callable.
81
     *
82
     * @param mixed $to Callback that returns the response when matched
83
     *
84
     * @return \Flight\Routing\Route|RouteCollection
85
     */
86
    public function options(string $pattern, mixed $to = null);
87
88
    /**
89
     * Maps a PATCH request to a callable.
90
     *
91
     * @param mixed $to Callback that returns the response when matched
92
     *
93
     * @return \Flight\Routing\Route|RouteCollection
94
     */
95
    public function patch(string $pattern, mixed $to = null);
96
97
    /**
98
     * Mount route collection into router.
99
     *
100
     * @param string $prefix The route named prefixCollection
101
     */
102
    public function group(string $prefix, callable|RouteCollection|null $collection = null): RouteCollection;
103
}
104