Blame view

tests/_support/MyMiddleware.php 860 Bytes
12bac7098   Paulo Costa   updated components
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  <?php
  
  /*
  * Sample middleware class to be used on tests
  */
  
  namespace Fccn\Tests;
  
  use Psr\Http\Message\ServerRequestInterface as Request;
  use Psr\Http\Message\ResponseInterface as Response;
  
  class MyMiddleware
  {
      /*
      * Middleware constructor
      *
      */
      public function __construct()
      {
      }
  
      /**
       * Locale middleware invokable class
       *
       * @param  \Psr\Http\Message\ServerRequestInterface $request  PSR7 request
       * @param  \Psr\Http\Message\ResponseInterface      $response PSR7 response
       * @param  callable                                 $next     Next middleware
       *
       * @return \Psr\Http\Message\ResponseInterface
       */
      public function __invoke(Request $req, Response $resp, callable $next)
      {
          $response->getBody()->write('MY MIDDLEWARE INSERTION');
          return $next($req, $resp);
      }
  }