Commit 1493a84
Collapse Router surface and fold wildcard into Router
Two public matching entry points (matchRoute + matchRequest) were a
mild smell; the method-agnostic wildcard living as a static singleton
on Http was an outright special case leaking into the Dispatcher.
Address both at once:
- Make Router::matchRoute(string, string) private. Router::matchRequest
is now the sole public matching API. External callers that used to
hand-roll parse_url + HEAD normalisation to call matchRoute now
just pass a Request.
- Delete the deprecated Router::match(string, string): ?Route shim.
- Move wildcard registration into Router via new Router::setWildcard;
delete Http::\$wildcardRoute and Http::getWildcardRoute. Http::wildcard
continues to return a Route, just registered on Router.
- Dispatcher's match section collapses from the \$url/\$matchMethod/
wildcard-fallback block to a single Router::matchRequest call.
- RouterTest/RouterMatchRouteTest migrate to matchRequest via a private
test helper that sets \$_SERVER and builds an FPM Request.
- Three new tests cover Router::setWildcard semantics (unknown path,
unknown method, and method-specific precedence over the wildcard).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent c6770ad commit 1493a84
5 files changed
Lines changed: 217 additions & 193 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 79 | + | |
89 | 80 | | |
90 | 81 | | |
91 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | 56 | | |
63 | 57 | | |
64 | 58 | | |
| |||
201 | 195 | | |
202 | 196 | | |
203 | 197 | | |
204 | | - | |
205 | | - | |
206 | | - | |
| 198 | + | |
| 199 | + | |
207 | 200 | | |
208 | 201 | | |
209 | 202 | | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
| 203 | + | |
| 204 | + | |
214 | 205 | | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
| 206 | + | |
224 | 207 | | |
225 | 208 | | |
226 | 209 | | |
| |||
688 | 671 | | |
689 | 672 | | |
690 | 673 | | |
691 | | - | |
692 | 674 | | |
693 | 675 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
35 | 41 | | |
36 | 42 | | |
37 | 43 | | |
| |||
106 | 112 | | |
107 | 113 | | |
108 | 114 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
114 | 118 | | |
115 | | - | |
| 119 | + | |
116 | 120 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
| 121 | + | |
160 | 122 | | |
161 | 123 | | |
162 | 124 | | |
163 | 125 | | |
164 | 126 | | |
165 | | - | |
166 | | - | |
| 127 | + | |
167 | 128 | | |
168 | | - | |
169 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
170 | 132 | | |
171 | 133 | | |
172 | 134 | | |
| |||
180 | 142 | | |
181 | 143 | | |
182 | 144 | | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
187 | 148 | | |
188 | | - | |
| 149 | + | |
189 | 150 | | |
190 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
191 | 200 | | |
192 | 201 | | |
193 | 202 | | |
| |||
248 | 257 | | |
249 | 258 | | |
250 | 259 | | |
| 260 | + | |
251 | 261 | | |
252 | 262 | | |
253 | 263 | | |
| |||
0 commit comments