public function __invoke(RequestInterface $request, ResponseInterface $response, callable $next = null) { $match = $this->matcher->match($request); if ($match->isMatched()) { $this->dispatcher->dispatch($match->getEvent()->getName(), $match->getEvent()); return $response->withStatus(200, 'push notification has been accepted'); } if (!$next) { return $response; } return $next($request, $response); }