@@ -38,7 +38,7 @@ include 'src/Autload.php'
38
38
39
39
use MinusFour\Router\Action;
40
40
use MinusFour\Router\Route;
41
- use MinusFour\Router\RouteContainer ;
41
+ use MinusFour\Router\TreeRouteContainer ;
42
42
use MinusFour\Router\Router;
43
43
```
44
44
@@ -75,13 +75,17 @@ $route->dispatch($_SERVER['REQUEST_METHOD'], strtok($_SERVER['REQUEST_URI'], '?'
75
75
76
76
It is possible to use regular expressions in some parts of the route. For example:
77
77
78
- ` $route = new Route('regex_route_example', '/section:(home|news)'); `
78
+ ``` php
79
+ $route = new Route('regex_route_example', '/section:(home|news)');
80
+ ```
79
81
80
82
It will match /home or /news.
81
83
82
84
It's possible to mix in static elements as well.
83
85
84
- ` $route = new Route('regex_route_example_2', '/section/name:(home|news)'); `
86
+ ``` php
87
+ $route = new Route('regex_route_example_2', '/section/name:(home|news)');
88
+ ```
85
89
86
90
Will match /section/home o /section/news.
87
91
@@ -96,9 +100,11 @@ not the path itself.
96
100
97
101
You shouldn't use a slash in your expressions.
98
102
99
- ` $route = new Route('regex_route_bad_example', '/section:(home/news|home/forums)'); `
103
+ ``` php
104
+ $route = new Route('regex_route_bad_example', '/section:(home/news|home/forums)');
105
+ ```
100
106
101
- Will not work. It will create static childrens for news|home and forums and the first element will be tested for (home.
107
+ Will not work. It will create static childrens for news|home, forums) and the first element will be tested for (home.
102
108
103
109
#### Multiple matches restriction
104
110
@@ -111,8 +117,8 @@ $route2 = new Route('regex_common_route_2', '/route2:\d+'); //Matches numbers.
111
117
```
112
118
113
119
And the path to be matched is: /123456. Only the first one will be matched, it will not even attempt to try out
114
- the second expression as there's already one that fits plus there's no way the Router could now the other one
115
- is the valid one, even though is a more restrictive expression.
120
+ the second expression as there's already one that fits plus there's no way the Router could know the other one
121
+ is the valid one, even though it's a more restrictive expression.
116
122
117
123
## HOWEVER
118
124
@@ -136,5 +142,5 @@ It will behave like this:
136
142
When the router fails to match a Route, it will throw a ` RouteNotFoundException ` . If it fails to find an action for
137
143
the specified method, it will throw a ` MethodNotFoundException ` . Both can be caught under a ` NotFoundException ` .
138
144
139
- ` RouteNotFoundException ` and ` MethodNotFoundException ` both live under ` / MinusFour/Router` while ` NotFoundException `
145
+ ` RouteNotFoundException ` and ` MethodNotFoundException ` live under ` MinusFour/Router ` while ` NotFoundException `
140
146
is under ` MinusFour\Utils ` .
0 commit comments