I can't find where the implementation of run()
method that is used on Lumen is defined. The one that can be seen in the bootstrapping file :
$app->run();
Where is this method defined?
It is defined on Laravel\\Lumen\\Concerns\\RoutesRequests
.
If you take a look at bootstrap/app.php
you'll see this:
$app = new Laravel\Lumen\Application(
dirname(__DIR__)
);
So we know that $app
is an instance of Laravel\\Lumen\\Application
.
The method run()
is not defined on this class, but if you look closely, you'll see this:
class Application extends Container
{
use Concerns\RoutesRequests,
Concerns\RegistersExceptionHandlers;
Those traits define additional behaviour for the class . Specifically, on Laravel\\Lumen\\Concerns\\RoutesRequests
you'll find:
/**
* Run the application and send the response.
*
* @param SymfonyRequest|null $request
* @return void
*/
public function run($request = null)
{
$response = $this->dispatch($request);
if ($response instanceof SymfonyResponse) {
$response->send();
} else {
echo (string) $response;
}
if (count($this->middleware) > 0) {
$this->callTerminableMiddleware($response);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.