Skip to content

Commit 77a2e14

Browse files
fix phpcs issues
1 parent f327fbb commit 77a2e14

File tree

3 files changed

+54
-55
lines changed

3 files changed

+54
-55
lines changed

AltoRouter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public function match($requestUrl = null, $requestMethod = null)
233233
$match = strcmp($requestUrl, $route) === 0;
234234
} else {
235235
// Compare longest non-param string with url before moving on to regex
236-
// 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)
236+
// 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)
237237
if (strncmp($requestUrl, $route, $position) !== 0 && ($lastRequestUrlChar === '/' || $route[$position-1] !== '/')) {
238238
continue;
239239
}

tests/AltoRouterTest.php

+13-14
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function key()
3636
{
3737
return $this->_position;
3838
}
39-
public function next() : void
39+
public function next() : void
4040
{
4141
++$this->_position;
4242
}
@@ -138,7 +138,7 @@ public function testAddRoutesThrowsExceptionOnInvalidArgument()
138138
*/
139139
public function testSetBasePath()
140140
{
141-
$this->router->setBasePath('/some/path');
141+
$this->router->setBasePath('/some/path');
142142
$this->assertEquals('/some/path', $this->router->getBasePath());
143143

144144
$this->router->setBasePath('/some/path');
@@ -514,18 +514,17 @@ public function testMatchWithUnicodeRegex()
514514
}
515515

516516
public function testMatchWithSlashBeforeOptionalPart()
517-
{
518-
$this->router->map('GET', '/archives/[lmin:category]?', 'Article#archives');
519-
$expected = [
520-
'target' => 'Article#archives',
521-
'params' => [],
522-
'name' => null
523-
];
524-
525-
$this->assertEquals($expected, $this->router->match('/archives/', 'GET'));
526-
$this->assertEquals($expected, $this->router->match('/archives', 'GET'));
527-
528-
}
517+
{
518+
$this->router->map('GET', '/archives/[lmin:category]?', 'Article#archives');
519+
$expected = [
520+
'target' => 'Article#archives',
521+
'params' => [],
522+
'name' => null
523+
];
524+
525+
$this->assertEquals($expected, $this->router->match('/archives/', 'GET'));
526+
$this->assertEquals($expected, $this->router->match('/archives', 'GET'));
527+
}
529528

530529
/**
531530
* @covers AltoRouter::addMatchTypes

tests/benchmark-parse-api.php

+40-40
Original file line numberDiff line numberDiff line change
@@ -13,46 +13,46 @@
1313

1414
require __DIR__ . '/../vendor/autoload.php';
1515
$routes = [
16-
["POST", "/1/classes/[a:className]"],
17-
["GET", "/1/classes/[a:className]/[i:objectId]"],
18-
["PUT", "/1/classes/[a:className]/[i:objectId]"],
19-
["GET", "/1/classes/[a:className]"],
20-
["DELETE", "/1/classes/[a:className]/[i:objectId]"],
21-
22-
// Users
23-
["POST", "/1/users"],
24-
["GET", "/1/login"],
25-
["GET", "/1/users/[i:objectId]"],
26-
["PUT", "/1/users/[i:objectId]"],
27-
["GET", "/1/users"],
28-
["DELETE", "/1/users/[i:objectId]"],
29-
["POST", "/1/requestPasswordReset"],
30-
31-
// Roles
32-
["POST", "/1/roles"],
33-
["GET", "/1/roles/[i:objectId]"],
34-
["PUT", "/1/roles/[i:objectId]"],
35-
["GET", "/1/roles"],
36-
["DELETE", "/1/roles/[i:objectId]"],
37-
38-
// Files
39-
["POST", "/1/files/:fileName"],
40-
41-
// Analytics
42-
["POST", "/1/events/[a:eventName]"],
43-
44-
// Push Notifications
45-
["POST", "/1/push"],
46-
47-
// Installations
48-
["POST", "/1/installations"],
49-
["GET", "/1/installations/[i:objectId]"],
50-
["PUT", "/1/installations/[i:objectId]"],
51-
["GET", "/1/installations"],
52-
["DELETE", "/1/installations/[i:objectId]"],
53-
54-
// Cloud Functions
55-
["POST", "/1/functions"],
16+
["POST", "/1/classes/[a:className]"],
17+
["GET", "/1/classes/[a:className]/[i:objectId]"],
18+
["PUT", "/1/classes/[a:className]/[i:objectId]"],
19+
["GET", "/1/classes/[a:className]"],
20+
["DELETE", "/1/classes/[a:className]/[i:objectId]"],
21+
22+
// Users
23+
["POST", "/1/users"],
24+
["GET", "/1/login"],
25+
["GET", "/1/users/[i:objectId]"],
26+
["PUT", "/1/users/[i:objectId]"],
27+
["GET", "/1/users"],
28+
["DELETE", "/1/users/[i:objectId]"],
29+
["POST", "/1/requestPasswordReset"],
30+
31+
// Roles
32+
["POST", "/1/roles"],
33+
["GET", "/1/roles/[i:objectId]"],
34+
["PUT", "/1/roles/[i:objectId]"],
35+
["GET", "/1/roles"],
36+
["DELETE", "/1/roles/[i:objectId]"],
37+
38+
// Files
39+
["POST", "/1/files/:fileName"],
40+
41+
// Analytics
42+
["POST", "/1/events/[a:eventName]"],
43+
44+
// Push Notifications
45+
["POST", "/1/push"],
46+
47+
// Installations
48+
["POST", "/1/installations"],
49+
["GET", "/1/installations/[i:objectId]"],
50+
["PUT", "/1/installations/[i:objectId]"],
51+
["GET", "/1/installations"],
52+
["DELETE", "/1/installations/[i:objectId]"],
53+
54+
// Cloud Functions
55+
["POST", "/1/functions"],
5656
];
5757
$total_time = 0;
5858
$router = new AltoRouter();

0 commit comments

Comments
 (0)