You are here

class BatApiMiddleware in Booking and Availability Management API 8

Provides a HTTP middleware.

Hierarchy

  • class \Drupal\bat_api\StackMiddleware\BatApiMiddleware implements \Symfony\Component\HttpKernel\HttpKernelInterface

Expanded class hierarchy of BatApiMiddleware

1 string reference to 'BatApiMiddleware'
bat_api.services.yml in ./bat_api.services.yml
bat_api.services.yml
1 service uses BatApiMiddleware
http_middleware.bat_api in ./bat_api.services.yml
Drupal\bat_api\StackMiddleware\BatApiMiddleware

File

src/StackMiddleware/BatApiMiddleware.php, line 15
Contains \Drupal\bat_api\StackMiddleware\BatApiMiddleware.php

Namespace

Drupal\bat_api\StackMiddleware
View source
class BatApiMiddleware implements HttpKernelInterface {

  /**
   * The wrapped HTTP kernel.
   *
   * @var \Symfony\Component\HttpKernel\HttpKernelInterface
   */
  protected $httpKernel;

  /**
   * Constructs a BatApiMiddleware object.
   *
   * @param \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel
   *   The decorated kernel.
   */
  public function __construct(HttpKernelInterface $http_kernel) {
    $this->httpKernel = $http_kernel;
  }

  /**
   * {@inheritdoc}
   */
  public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {
    if ($format = $request
      ->get('_format')) {
      $request
        ->setRequestFormat($format);
    }
    return $this->httpKernel
      ->handle($request, $type, $catch);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BatApiMiddleware::$httpKernel protected property The wrapped HTTP kernel.
BatApiMiddleware::handle public function Handles a Request to convert it to a Response.
BatApiMiddleware::__construct public function Constructs a BatApiMiddleware object.