Applied phpcbf

pull/545/head
fadrian06 11 months ago
parent d9e5185087
commit 4d064cbb6d

@ -362,17 +362,16 @@ class Engine
} }
/** /**
* Processes each routes middleware * Processes each routes middleware.
* *
* @param array<int,callable> $middleware middleware attached to the route * @param array<int, callable> $middleware Middleware attached to the route.
* @param array<mixed,mixed> $params route->params * @param array<mixed> $params `$route->params`.
* @param string $event_name if this is the before or after method * @param string $event_name If this is the before or after method.
*
* @return boolean
*/ */
protected function processMiddleware(array $middleware, array $params, string $event_name): bool protected function processMiddleware(array $middleware, array $params, string $event_name): bool
{ {
$at_least_one_middleware_failed = false; $at_least_one_middleware_failed = false;
foreach ($middleware as $middleware) { foreach ($middleware as $middleware) {
$middleware_object = false; $middleware_object = false;
@ -382,7 +381,9 @@ class Engine
? $middleware ? $middleware
: (method_exists($middleware, 'before') === true : (method_exists($middleware, 'before') === true
? [$middleware, 'before'] ? [$middleware, 'before']
: false)); : false
)
);
} elseif ($event_name === 'after') { } elseif ($event_name === 'after') {
// must be an object. No functions allowed here // must be an object. No functions allowed here
if ( if (
@ -418,11 +419,9 @@ class Engine
return $at_least_one_middleware_failed; return $at_least_one_middleware_failed;
} }
/********************************* ////////////////////////
* // Extensible Methods //
* Extensible Methods ////////////////////////
*********************************/
/** /**
* Starts the framework. * Starts the framework.
* *
@ -454,6 +453,7 @@ class Engine
// Route the request // Route the request
$failed_middleware_check = false; $failed_middleware_check = false;
while ($route = $router->route($request)) { while ($route = $router->route($request)) {
$params = array_values($route->params); $params = array_values($route->params);

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
// This file is only here so that the PHP8 attribute for doesn't throw an error in files // This file is only here so that the PHP8 attribute for doesn't throw an error in files

Loading…
Cancel
Save