3 namespace Drupal\{{ machine_name }};
5 use Drupal\Core\StringTranslation\StringTranslationTrait;
6 use Symfony\Component\HttpFoundation\Request;
7 use Symfony\Component\HttpFoundation\Response;
8 use Symfony\Component\HttpKernel\HttpKernelInterface;
11 * {{ class }} middleware.
13 class {{ class }} implements HttpKernelInterface {
15 use StringTranslationTrait;
20 * @var \Symfony\Component\HttpKernel\HttpKernelInterface
22 protected $httpKernel;
25 * Constructs the {{ class }} object.
27 * @param \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel
28 * The decorated kernel.
30 public function __construct(HttpKernelInterface $http_kernel) {
31 $this->httpKernel = $http_kernel;
37 public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {
39 if ($request->getClientIp() == '127.0.0.10') {
40 return new Response($this->t('Bye!'), 403);
43 return $this->httpKernel->handle($request, $type, $catch);