Skip to content

Commit e4ff5a3

Browse files
committed
some bug fixed
1 parent 7ddfaad commit e4ff5a3

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

src/Base/AbstractRouter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ public function ctrl(string $prefix, string $controllerClass, array $map = [], a
361361
public function group(string $prefix, \Closure $callback, array $opts = [])
362362
{
363363
$previousGroupPrefix = $this->currentGroupPrefix;
364-
$this->currentGroupPrefix = $previousGroupPrefix . '/' . trim($prefix, '/');
364+
$this->currentGroupPrefix = $previousGroupPrefix . '/' . \trim($prefix, '/');
365365

366366
$previousGroupOption = $this->currentGroupOption;
367367
$this->currentGroupOption = $opts;

src/ServerRouter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ final class ServerRouter extends ORouter
2727
* The param route cache number.
2828
* @var int
2929
*/
30-
public $tmpCacheNumber = 100;
30+
public $tmpCacheNumber = 300;
3131

3232
/**
3333
* There are last route caches. like static routes
@@ -229,11 +229,11 @@ public function match(string $path, string $method = 'GET'): array
229229
protected function findInStaticRoutes(string $path, string $method)
230230
{
231231
// if flattenStatic is TRUE
232-
if ($this->flattenStatic) {
232+
if ($this->flatStaticRoutes) {
233233
$key = $path . '#' . $method;
234234

235235
if (isset($this->flatStaticRoutes[$key])) {
236-
return $this->staticRoutes[$key];
236+
return $this->flatStaticRoutes[$key];
237237
}
238238
} elseif (isset($this->staticRoutes[$path][$method])) {
239239
return $this->staticRoutes[$path][$method];

test/ORouterTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ public function testComplexRoute()
9292

9393
$ret = $router->match('/my/tom/not-match', 'GET');
9494
$this->assertSame(ORouter::NOT_FOUND, $ret[0]);
95-
96-
9795
}
9896

9997
public function testStaticRoute()
@@ -158,7 +156,7 @@ public function testParamRoute()
158156
$ret = $router->match('/hi/tom', 'GET');
159157

160158
$this->assertCount(3, $ret);
161-
// var_dump($ret, $router->getRegularRoutes());die;
159+
162160
list($status, $path, $route) = $ret;
163161

164162
$this->assertSame(ORouter::FOUND, $status);

0 commit comments

Comments
 (0)