diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-10-23 23:27:15 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2014-10-24 12:27:53 +0200 |
commit | d060180140923ac054b252f0cbd821063a53f5b7 (patch) | |
tree | 59d53bb16be35960f493709d8409a75bc79be47e /lib/private/appframework | |
parent | 9739a25547e5f8f7500b0a962780cb9267b47cd1 (diff) | |
download | nextcloud-server-d060180140923ac054b252f0cbd821063a53f5b7.tar.gz nextcloud-server-d060180140923ac054b252f0cbd821063a53f5b7.zip |
Use function outside of loop
Otherwise the function is executed n times which is a lot of overhead
Diffstat (limited to 'lib/private/appframework')
-rw-r--r-- | lib/private/appframework/middleware/middlewaredispatcher.php | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/private/appframework/middleware/middlewaredispatcher.php b/lib/private/appframework/middleware/middlewaredispatcher.php index dcb63a8e552..41eef4aedb9 100644 --- a/lib/private/appframework/middleware/middlewaredispatcher.php +++ b/lib/private/appframework/middleware/middlewaredispatcher.php @@ -82,8 +82,9 @@ class MiddlewareDispatcher { */ public function beforeController(Controller $controller, $methodName){ // we need to count so that we know which middlewares we have to ask in - // case theres an exception - for($i=0; $i<count($this->middlewares); $i++){ + // case there is an exception + $middlewareCount = count($this->middlewares); + for($i = 0; $i < $middlewareCount; $i++){ $this->middlewareCounter++; $middleware = $this->middlewares[$i]; $middleware->beforeController($controller, $methodName); |