src/Middleware/Dispatch.php
protected function run(Request $request)
	{
		// If there's nothing to dispatch, continue along the middleware pipeline
		$handler = $request->getAttribute('dispatch.handler', false);
		if ($handler === false) {
			return $this->chain($request);
		}

		// Setup any remaining chained parts of the dispatch for future dispatch
		$request = $request->withAttribute('dispatch.handler', $this->resolver->shift($handler));

		// Resolve the handler into something callable
		$dispatchable = $this->resolver->resolve($handler, $resolutionType);

		// Dispatch
		$parameters = [
			$dispatchable,
			$resolutionType,
			DispatchAdaptorInterface::SOURCE_DISPATCH_MIDDLEWARE,
			$request
		];
		$response = $this->getResponseObject();
		if ($response !== null) {
			$parameters[] = $response;
		}
		return $this->dispatcher->dispatch(...$parameters) ?: $this->chain($request);
	}
protected function run(Request $request)
	{
		// If there's nothing to dispatch, continue along the middleware pipeline
		$handler = $request->getAttribute('dispatch.handler', false);
		if ($handler === false) {
			return $this->chain($request);
		}

		// Setup any remaining chained parts of the dispatch for future dispatch
		$request = $request->withAttribute('dispatch.handler', $this->resolver->shift($handler));

		// Resolve the handler into something callable
		$dispatchable = $this->resolver->resolve($handler, $resolutionType);

		// Dispatch
		$parameters = [
			$dispatchable,
			$resolutionType,
			DispatchAdaptorInterface::SOURCE_DISPATCH_MIDDLEWARE,
			$request
		];
		$response = $this->getResponseObject();
		if ($response !== null) {
			$parameters[] = $response;
		}
		return $this->dispatcher->dispatch(...$parameters) ?: $this->chain($request);
	}
protected function run ( Request $ request ) { // If there's nothing to dispatch, continue along the middleware pipeline $ handler = $ request -> getAttribute ( 'dispatch.handler' , false ) ; if ( $ handler === false ) { return $ this -> chain ( $ request ) ; } // Setup any remaining chained parts of the dispatch for future dispatch $ request = $ request -> withAttribute ( 'dispatch.handler' , $ this -> resolver -> shift ( $ handler ) ) ; // Resolve the handler into something callable $ dispatchable = $ this -> resolver -> resolve ( $ handler , $ resolutionType ) ; // Dispatch $ parameters = [ $ dispatchable , $ resolutionType , DispatchAdaptorInterface :: SOURCE_DISPATCH_MIDDLEWARE , $ request ] ; $ response = $ this -> getResponseObject ( ) ; if ( $ response !== null ) { $ parameters [ ] = $ response ; } return $ this -> dispatcher -> dispatch ( ... $ parameters ) ? : $ this -> chain ( $ request ) ; }
Handle a dispatch.

@param Request $request The request.

@return Response
Handle a dispatch .