diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /lib/private/AppFramework/Middleware/MiddlewareDispatcher.php | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) | |
download | nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip |
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.
This also removes and empty lines from method/function bodies at the
beginning and end.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/AppFramework/Middleware/MiddlewareDispatcher.php')
-rw-r--r-- | lib/private/AppFramework/Middleware/MiddlewareDispatcher.php | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php b/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php index 47b9a62af81..388e86c1e15 100644 --- a/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php +++ b/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php @@ -91,7 +91,7 @@ class MiddlewareDispatcher { // we need to count so that we know which middlewares we have to ask in // case there is an exception $middlewareCount = \count($this->middlewares); - for($i = 0; $i < $middlewareCount; $i++){ + for ($i = 0; $i < $middlewareCount; $i++) { $this->middlewareCounter++; $middleware = $this->middlewares[$i]; $middleware->beforeController($controller, $methodName); @@ -115,11 +115,11 @@ class MiddlewareDispatcher { * @throws \Exception the passed in exception if it can't handle it */ public function afterException(Controller $controller, string $methodName, \Exception $exception): Response { - for($i=$this->middlewareCounter-1; $i>=0; $i--){ + for ($i=$this->middlewareCounter-1; $i>=0; $i--) { $middleware = $this->middlewares[$i]; try { return $middleware->afterException($controller, $methodName, $exception); - } catch(\Exception $exception){ + } catch (\Exception $exception) { continue; } } @@ -138,7 +138,7 @@ class MiddlewareDispatcher { * @return Response a Response object */ public function afterController(Controller $controller, string $methodName, Response $response): Response { - for($i= \count($this->middlewares)-1; $i>=0; $i--){ + for ($i= \count($this->middlewares)-1; $i>=0; $i--) { $middleware = $this->middlewares[$i]; $response = $middleware->afterController($controller, $methodName, $response); } @@ -157,11 +157,10 @@ class MiddlewareDispatcher { * @return string the output that should be printed */ public function beforeOutput(Controller $controller, string $methodName, string $output): string { - for($i= \count($this->middlewares)-1; $i>=0; $i--){ + for ($i= \count($this->middlewares)-1; $i>=0; $i--) { $middleware = $this->middlewares[$i]; $output = $middleware->beforeOutput($controller, $methodName, $output); } return $output; } - } |