From 388baa01b49fb47b7187c03bfdaa87b6712f5cdd Mon Sep 17 00:00:00 2001 From: Aaron Carlino Date: Wed, 20 Mar 2019 13:08:56 +1300 Subject: [PATCH] Fix linting --- src/Control/Director.php | 5 ++--- src/Control/Middleware/HTTPMiddlewareAware.php | 11 +---------- tests/behat/src/CmsUiContext.php | 6 +++--- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/Control/Director.php b/src/Control/Director.php index 51827f628..8b85e1fee 100644 --- a/src/Control/Director.php +++ b/src/Control/Director.php @@ -365,13 +365,12 @@ class Director implements TemplateGlobalProvider }; break; } -$start = time(); + // Call the handler with the configured middlewares $response = $this->callMiddleware($request, $handler); -$end = time(); + // Note that if a different request was previously registered, this will now be lost // In these cases it's better to use Kernel::nest() prior to kicking off a nested request - $elapsed = $end - $start; Injector::inst()->unregisterNamedObject(HTTPRequest::class); return $response; diff --git a/src/Control/Middleware/HTTPMiddlewareAware.php b/src/Control/Middleware/HTTPMiddlewareAware.php index 36ff486c1..e7e861898 100644 --- a/src/Control/Middleware/HTTPMiddlewareAware.php +++ b/src/Control/Middleware/HTTPMiddlewareAware.php @@ -54,21 +54,12 @@ trait HTTPMiddlewareAware */ protected function callMiddleware(HTTPRequest $request, callable $last) { - $classes = array_map(function ($middle) { - return get_class($middle); - }, $this->getMiddlewares()); - - // Reverse middlewares $next = $last; /** @var HTTPMiddleware $middleware */ foreach (array_reverse($this->getMiddlewares()) as $middleware) { $next = function ($request) use ($middleware, $next) { - $start = time(); - $value = $middleware->process($request, $next); - $end = time(); - $elapsed = $end - $start; - return $value; + return $middleware->process($request, $next); }; } return $next($request); diff --git a/tests/behat/src/CmsUiContext.php b/tests/behat/src/CmsUiContext.php index 6797dc65f..1946f30cc 100644 --- a/tests/behat/src/CmsUiContext.php +++ b/tests/behat/src/CmsUiContext.php @@ -58,9 +58,9 @@ class CmsUiContext implements Context $timeoutMs = $this->getMainContext()->getAjaxTimeout(); $this->getSession()->wait( $timeoutMs, - "(". - "document.getElementsByClassName('cms-content-loading-overlay').length +". - "document.getElementsByClassName('cms-loading-container').length". + "(" . + "document.getElementsByClassName('cms-content-loading-overlay').length +" . + "document.getElementsByClassName('cms-loading-container').length" . ") == 0" ); }