Last active
May 3, 2020 15:31
-
-
Save anvodev/6a581835616af08d0f0d4a879b72feb6 to your computer and use it in GitHub Desktop.
finish handling the request and return the response
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //vendor/symfony/http-kernel/HttpKernel.php | |
| <?php | |
| private function handleRaw(Request $request, int $type = self::MASTER_REQUEST): Response | |
| { | |
| //...previous stages | |
| // call controller | |
| $response = $controller(...$arguments); | |
| // view | |
| if (!$response instanceof Response) { | |
| $event = new ViewEvent($this, $request, $type, $response); | |
| $this->dispatcher->dispatch($event, KernelEvents::VIEW); | |
| //... | |
| } | |
| return $this->filterResponse($response, $request, $type); | |
| } | |
| private function filterResponse(Response $response, Request $request, int $type): Response | |
| { | |
| $event = new ResponseEvent($this, $request, $type, $response); | |
| $this->dispatcher->dispatch($event, KernelEvents::RESPONSE); | |
| $this->finishRequest($request, $type); | |
| return $event->getResponse(); | |
| } | |
| private function finishRequest(Request $request, int $type) | |
| { | |
| $this->dispatcher->dispatch(new FinishRequestEvent($this, $request, $type), KernelEvents::FINISH_REQUEST); | |
| $this->requestStack->pop(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment