@@ -70,7 +70,7 @@ |
||
| 70 | 70 | |
| 71 | 71 | if (!empty($route->getWhere())) { |
| 72 | 72 | foreach ($route->getWhere() as $attribute => $where) { |
| 73 | - $path = preg_replace('#{('.$attribute.')}#', '('.$where.')', $path); |
|
| 73 | + $path = preg_replace('#{(' . $attribute . ')}#', '(' . $where . ')', $path); |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | $path = preg_replace("#{([\w]+)}#", '([^/]+)', $path); |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | $router = new Router(); |
| 8 | 8 | |
| 9 | 9 | $router->get('/home/{id}/{foo}', 'home', function ($id) { |
| 10 | - echo 'hi from home ' . $id; |
|
| 10 | + echo 'hi from home ' . $id; |
|
| 11 | 11 | })->where(['id' => '[0-9]+']); |
| 12 | 12 | |
| 13 | 13 | $request = \GuzzleHttp\Psr7\ServerRequest::fromGlobals(); |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | |
| 7 | 7 | $router = new Router(); |
| 8 | 8 | |
| 9 | -$router->get('/home/{id}/{foo}', 'home', function ($id) { |
|
| 9 | +$router->get('/home/{id}/{foo}', 'home', function($id) { |
|
| 10 | 10 | echo 'hi from home ' . $id; |
| 11 | 11 | })->where(['id' => '[0-9]+']); |
| 12 | 12 | |
@@ -109,7 +109,7 @@ |
||
| 109 | 109 | */ |
| 110 | 110 | public function generatePath(array $params = []): string |
| 111 | 111 | { |
| 112 | - return preg_replace_callback('/\{(.*?)\}/', function ($m) use (&$params) { |
|
| 112 | + return preg_replace_callback('/\{(.*?)\}/', function($m) use (&$params) { |
|
| 113 | 113 | if (isset($params[$m[1]])) { |
| 114 | 114 | return $params[$m[1]]; |
| 115 | 115 | } |