Total Complexity | 5 |
Total Lines | 57 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | final class PathPattern implements PathMatcherInterface |
||
14 | { |
||
15 | private WildcardPattern $pattern; |
||
16 | |||
17 | /** |
||
18 | * @param string $pattern The path pattern to match against. |
||
19 | */ |
||
20 | public function __construct(string $pattern) |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * Make pattern case sensitive. |
||
30 | * @return self |
||
31 | */ |
||
32 | public function caseSensitive(): self |
||
33 | { |
||
34 | $new = clone $this; |
||
35 | $new->pattern = $this->pattern->ignoreCase(false); |
||
36 | return $new; |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * Match full path, not just ending of path. |
||
41 | * @return self |
||
42 | */ |
||
43 | public function withFullPath(): self |
||
44 | { |
||
45 | $new = clone $this; |
||
46 | $new->pattern = $this->pattern->withEnding(false); |
||
47 | return $new; |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * Match `/` character with wildcards. |
||
52 | * @return self |
||
53 | */ |
||
54 | public function withNotExactSlashes(): self |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * Checks if the passed path would match the given shell path pattern. |
||
63 | * |
||
64 | * @param string $path The tested path. |
||
65 | * @return bool Whether the path matches pattern or not. |
||
66 | */ |
||
67 | public function match(string $path): bool |
||
70 | } |
||
71 | } |
||
72 |