mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 22:53:37 +08:00
Update FastRoute
This enables optional route parameters. Required some code changes in the RouteCollection class; once we actually use optional route parameters, we will have to see whether route generation for those works as expected. Closes flarum/core#108
This commit is contained in:
parent
cca97398ae
commit
150b8d7cd3
|
@ -18,7 +18,7 @@
|
|||
"ezyang/htmlpurifier": "dev-master",
|
||||
"psr/http-message": "^1.0@dev",
|
||||
"zendframework/zend-diactoros": "^1.1",
|
||||
"nikic/fast-route": "dev-master",
|
||||
"nikic/fast-route": "^0.6",
|
||||
"dflydev/fig-cookies": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
|
|
6
framework/core/composer.lock
generated
6
framework/core/composer.lock
generated
|
@ -581,12 +581,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nikic/FastRoute.git",
|
||||
"reference": "ffb3b68a3ab0df7e60cf587d2de4937915670f16"
|
||||
"reference": "31fa86924556b80735f98b294a7ffdfb26789f22"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nikic/FastRoute/zipball/31fa86924556b80735f98b294a7ffdfb26789f22",
|
||||
"reference": "ffb3b68a3ab0df7e60cf587d2de4937915670f16",
|
||||
"reference": "31fa86924556b80735f98b294a7ffdfb26789f22",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -616,7 +616,7 @@
|
|||
"router",
|
||||
"routing"
|
||||
],
|
||||
"time": "2015-05-15 16:58:32"
|
||||
"time": "2015-06-18 19:15:47"
|
||||
},
|
||||
{
|
||||
"name": "oyejorge/less.php",
|
||||
|
|
|
@ -50,13 +50,13 @@ class RouteCollection
|
|||
|
||||
public function addRoute($method, $path, $name, $handler)
|
||||
{
|
||||
$this->dataGenerator->addRoute(
|
||||
$method,
|
||||
$parsed = $this->routeParser->parse($path),
|
||||
$handler
|
||||
);
|
||||
$routeDatas = $this->routeParser->parse($path);
|
||||
|
||||
$this->reverse[$name] = $parsed;
|
||||
foreach ($routeDatas as $routeData) {
|
||||
$this->dataGenerator->addRoute($method, $routeData, $handler);
|
||||
}
|
||||
|
||||
$this->reverse[$name] = $routeDatas;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ class RouteCollection
|
|||
|
||||
public function getPath($name, $parameters = [])
|
||||
{
|
||||
$parts = $this->reverse[$name];
|
||||
$parts = $this->reverse[$name][0];
|
||||
|
||||
$path = implode('', array_map(function ($part) use ($parameters) {
|
||||
if (is_array($part)) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user