Issues (101)

src/ParserInterface.php (1 issue)

Labels
Severity
1
<?php
2
declare(strict_types=1);
3
4
namespace Lead\Router;
5
6
/**
7
 * ParserInterface
8
 */
9
interface ParserInterface
10
{
11
    /**
12
     * Tokenizes a route pattern. Optional segments are identified by square brackets.
13
     *
14
     * @param string $pattern A route pattern
15
     * @param string $delimiter The path delimiter.
16
     * @param array The tokens structure root node.
0 ignored issues
show
The type Lead\Router\The 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...
17
     * @return array
18
     */
19
    public static function tokenize(string $pattern, string $delimiter = '/'): array;
20
21
    /**
22
     * Splits a pattern in segments and patterns.
23
     * segments will be represented by string value and patterns by an array containing
24
     * the string pattern as first value and the greedy value as second value.
25
     * example:
26
     * `/user[/{id}]*` will gives `['/user', ['id', '*']]`
27
     * Unfortunately recursive regex matcher can't help here so this function is required.
28
     *
29
     * @param string $pattern A route pattern.
30
     * @param array The split pattern.
31
     * @return array
32
     */
33
    public static function split(string $pattern): array;
34
35
    /**
36
     * Builds a regex from a tokens structure array.
37
     *
38
     * @param array $token A tokens structure root node.
39
     * @return array An array containing the regex pattern and its associated variable names.
40
     */
41
    public static function compile($token): array;
42
}
43