SergiX44/XBackBone

View on GitHub
app/Middleware/InjectMiddleware.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace App\Middleware;

use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Server\RequestHandlerInterface as RequestHandler;

class InjectMiddleware extends Middleware
{
    /**
     * @param Request        $request
     * @param RequestHandler $handler
     *
     * @return Response
     */
    public function __invoke(Request $request, RequestHandler $handler)
    {
        $this->view->getTwig()->addGlobal('customHead', $this->getSetting('custom_head'));

        return $handler->handle($request);
    }
}