mirror of
https://github.com/dannyvankooten/AltoRouter.git
synced 2025-01-16 20:08:12 +01:00
fix phpcs issues
This commit is contained in:
parent
f327fbb5bf
commit
77a2e14681
@ -233,7 +233,7 @@ class AltoRouter
|
||||
$match = strcmp($requestUrl, $route) === 0;
|
||||
} else {
|
||||
// Compare longest non-param string with url before moving on to regex
|
||||
// Check if last character before param is a slash, because it could be optional if param is optional too (see https://github.com/dannyvankooten/AltoRouter/issues/241)
|
||||
// Check if last character before param is a slash, because it could be optional if param is optional too (see https://github.com/dannyvankooten/AltoRouter/issues/241)
|
||||
if (strncmp($requestUrl, $route, $position) !== 0 && ($lastRequestUrlChar === '/' || $route[$position-1] !== '/')) {
|
||||
continue;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class SimpleTraversable implements Iterator
|
||||
{
|
||||
return $this->_position;
|
||||
}
|
||||
public function next() : void
|
||||
public function next() : void
|
||||
{
|
||||
++$this->_position;
|
||||
}
|
||||
@ -138,7 +138,7 @@ class AltoRouterTest extends PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testSetBasePath()
|
||||
{
|
||||
$this->router->setBasePath('/some/path');
|
||||
$this->router->setBasePath('/some/path');
|
||||
$this->assertEquals('/some/path', $this->router->getBasePath());
|
||||
|
||||
$this->router->setBasePath('/some/path');
|
||||
@ -514,18 +514,17 @@ class AltoRouterTest extends PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
public function testMatchWithSlashBeforeOptionalPart()
|
||||
{
|
||||
$this->router->map('GET', '/archives/[lmin:category]?', 'Article#archives');
|
||||
$expected = [
|
||||
'target' => 'Article#archives',
|
||||
'params' => [],
|
||||
'name' => null
|
||||
];
|
||||
{
|
||||
$this->router->map('GET', '/archives/[lmin:category]?', 'Article#archives');
|
||||
$expected = [
|
||||
'target' => 'Article#archives',
|
||||
'params' => [],
|
||||
'name' => null
|
||||
];
|
||||
|
||||
$this->assertEquals($expected, $this->router->match('/archives/', 'GET'));
|
||||
$this->assertEquals($expected, $this->router->match('/archives', 'GET'));
|
||||
|
||||
}
|
||||
$this->assertEquals($expected, $this->router->match('/archives/', 'GET'));
|
||||
$this->assertEquals($expected, $this->router->match('/archives', 'GET'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers AltoRouter::addMatchTypes
|
||||
|
@ -13,46 +13,46 @@
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
$routes = [
|
||||
["POST", "/1/classes/[a:className]"],
|
||||
["GET", "/1/classes/[a:className]/[i:objectId]"],
|
||||
["PUT", "/1/classes/[a:className]/[i:objectId]"],
|
||||
["GET", "/1/classes/[a:className]"],
|
||||
["DELETE", "/1/classes/[a:className]/[i:objectId]"],
|
||||
["POST", "/1/classes/[a:className]"],
|
||||
["GET", "/1/classes/[a:className]/[i:objectId]"],
|
||||
["PUT", "/1/classes/[a:className]/[i:objectId]"],
|
||||
["GET", "/1/classes/[a:className]"],
|
||||
["DELETE", "/1/classes/[a:className]/[i:objectId]"],
|
||||
|
||||
// Users
|
||||
["POST", "/1/users"],
|
||||
["GET", "/1/login"],
|
||||
["GET", "/1/users/[i:objectId]"],
|
||||
["PUT", "/1/users/[i:objectId]"],
|
||||
["GET", "/1/users"],
|
||||
["DELETE", "/1/users/[i:objectId]"],
|
||||
["POST", "/1/requestPasswordReset"],
|
||||
// Users
|
||||
["POST", "/1/users"],
|
||||
["GET", "/1/login"],
|
||||
["GET", "/1/users/[i:objectId]"],
|
||||
["PUT", "/1/users/[i:objectId]"],
|
||||
["GET", "/1/users"],
|
||||
["DELETE", "/1/users/[i:objectId]"],
|
||||
["POST", "/1/requestPasswordReset"],
|
||||
|
||||
// Roles
|
||||
["POST", "/1/roles"],
|
||||
["GET", "/1/roles/[i:objectId]"],
|
||||
["PUT", "/1/roles/[i:objectId]"],
|
||||
["GET", "/1/roles"],
|
||||
["DELETE", "/1/roles/[i:objectId]"],
|
||||
// Roles
|
||||
["POST", "/1/roles"],
|
||||
["GET", "/1/roles/[i:objectId]"],
|
||||
["PUT", "/1/roles/[i:objectId]"],
|
||||
["GET", "/1/roles"],
|
||||
["DELETE", "/1/roles/[i:objectId]"],
|
||||
|
||||
// Files
|
||||
["POST", "/1/files/:fileName"],
|
||||
// Files
|
||||
["POST", "/1/files/:fileName"],
|
||||
|
||||
// Analytics
|
||||
["POST", "/1/events/[a:eventName]"],
|
||||
// Analytics
|
||||
["POST", "/1/events/[a:eventName]"],
|
||||
|
||||
// Push Notifications
|
||||
["POST", "/1/push"],
|
||||
// Push Notifications
|
||||
["POST", "/1/push"],
|
||||
|
||||
// Installations
|
||||
["POST", "/1/installations"],
|
||||
["GET", "/1/installations/[i:objectId]"],
|
||||
["PUT", "/1/installations/[i:objectId]"],
|
||||
["GET", "/1/installations"],
|
||||
["DELETE", "/1/installations/[i:objectId]"],
|
||||
// Installations
|
||||
["POST", "/1/installations"],
|
||||
["GET", "/1/installations/[i:objectId]"],
|
||||
["PUT", "/1/installations/[i:objectId]"],
|
||||
["GET", "/1/installations"],
|
||||
["DELETE", "/1/installations/[i:objectId]"],
|
||||
|
||||
// Cloud Functions
|
||||
["POST", "/1/functions"],
|
||||
// Cloud Functions
|
||||
["POST", "/1/functions"],
|
||||
];
|
||||
$total_time = 0;
|
||||
$router = new AltoRouter();
|
||||
|
Loading…
x
Reference in New Issue
Block a user