Issues (7)

src/Business/Executor/RouteMiddlewareExecutor.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 *  This file is part of the Micro framework package.
7
 *
8
 *  (c) Stanislau Komar <[email protected]>
9
 *
10
 *  For the full copyright and license information, please view the LICENSE
11
 *  file that was distributed with this source code.
12
 */
13
14
namespace Micro\Plugin\Http\Business\Executor;
15
16
use Micro\Plugin\Http\Business\Middleware\MiddlewareLocatorInterface;
17
use Micro\Plugin\Http\Plugin\HttpMiddlewarePluginInterface;
18
use Symfony\Component\HttpFoundation\Request;
19
use Symfony\Component\HttpFoundation\Response;
20
21
/**
22
 * @author Stanislau Komar <[email protected]>
23
 */
24
readonly class RouteMiddlewareExecutor implements RouteExecutorInterface
0 ignored issues
show
A parse error occurred: Syntax error, unexpected T_READONLY on line 24 at column 0
Loading history...
25
{
26 2
    public function __construct(
27
        private RouteExecutorInterface $decorated,
28
        private MiddlewareLocatorInterface $middlewareLocator
29
    ) {
30 2
    }
31
32 1
    public function execute(Request $request, bool $flush = true): Response
33
    {
34
        /** @var HttpMiddlewarePluginInterface $middleware */
35 1
        foreach ($this->middlewareLocator->locate($request) as $middleware) {
36 1
            $middleware->processMiddleware($request);
37
        }
38
39 1
        return $this->decorated->execute($request, $flush);
40
    }
41
}
42