Development

- Fixed BootManager not loading.
- Optimised for-loops.
This commit is contained in:
Simon Sessingø
2016-11-25 02:27:46 +01:00
parent 7edee8e6d3
commit 2dd2d95af5
5 changed files with 16 additions and 13 deletions
@@ -107,10 +107,10 @@ abstract class LoadableRoute extends Route implements ILoadableRoute
/* Let's parse the values of any {} parameter in the url */
$max = count($params);
$max = count($params) - 1;
$keys = array_keys($params);
for ($i = 0; $i < $max; $i++) {
for ($i = $max; $i >= 0; $i--) {
$param = $keys[$i];
$value = $params[$param];
+5 -4
View File
@@ -77,10 +77,11 @@ abstract class Route implements IRoute
$lastCharacter = '';
$isParameter = false;
$parameter = '';
$routeLength = strlen($route) - 1;
for ($i = 0; $i < strlen($route); $i++) {
for ($i = $routeLength; $i >= 0; $i--) {
$character = $route[$i];
$character = strrev($route)[$i];
if ($character === '{') {
/* Remove "/" and "\" from regex */
@@ -129,9 +130,9 @@ abstract class Route implements IRoute
$parameters = [];
$max = count($parameterNames);
$max = count($parameterNames) - 1;
for ($i = 0; $i < $max; $i++) {
for ($i = $max; $i >= 0; $i--) {
$name = $parameterNames[$i];
@@ -59,6 +59,7 @@ class RouteController extends LoadableRoute implements IControllerRoute
/* Remove requestType from method-name, if it exists */
if ($method !== null) {
$max = count(static::$requestTypes);
for ($i = 0; $i < $max; $i++) {
@@ -70,6 +71,7 @@ class RouteController extends LoadableRoute implements IControllerRoute
break;
}
}
$method .= '/';
}
+2 -2
View File
@@ -20,9 +20,9 @@ class RouteGroup extends Route implements IGroupRoute
{
if (count($this->domains) > 0) {
$max = count($this->domains);
$max = count($this->domains) - 1;
for ($i = 0; $i < $max; $i++) {
for ($i = $max; $i >= 0; $i--) {
$domain = $this->domains[$i];
$parameters = $this->parseParameters($domain, $request->getHost(), '.*');