| @@ 40-55 (lines=16) @@ | ||
| 37 | * | |
| 38 |      * {@inheritDoc} | |
| 39 | */ | |
| 40 | public function process( | |
| 41 | RequestInterface $request, | |
| 42 | ResponseInterface $response, | |
| 43 | DelegateInterface $next = null | |
| 44 |     ) { | |
| 45 | // before | |
| 46 | $response = $this->before($request, $response); | |
| 47 | ||
| 48 | // next middleware | |
| 49 |         if ($next) { | |
| 50 | $response = $next->next($request, $response); | |
| 51 | } | |
| 52 | ||
| 53 | // after | |
| 54 | return $this->after($request, $response); | |
| 55 | } | |
| 56 | ||
| 57 | /** | |
| 58 | * Doing stuff before calling next middleware | |
| @@ 91-107 (lines=17) @@ | ||
| 88 | /** | |
| 89 |      * {@inheritDoc} | |
| 90 | */ | |
| 91 | public function process( | |
| 92 | RequestInterface $request, | |
| 93 | ResponseInterface $response, | |
| 94 | DelegateInterface $next = null | |
| 95 |     )/*# : ResponseInterface */ { | |
| 96 | // rewind | |
| 97 | $this->queue->rewind(); | |
| 98 | ||
| 99 | // process the queue | |
| 100 | $response = $this->next($request, $response); | |
| 101 | ||
| 102 |         if ($next) { // queue is part of another queue | |
| 103 | return $next->next($request, $response); | |
| 104 |         } else { | |
| 105 | return $response; | |
| 106 | } | |
| 107 | } | |
| 108 | ||
| 109 | /** | |
| 110 |      * {@inheritDoc} | |