Run framework.

@param \Illuminate\Http\Request $request

@return \Illuminate\Http\Response
@throws \SwooleTW\Http\Exceptions\SandboxException
@throws \ReflectionException
497403
public function run(Request $request)
    {
        if (! $this->getSnapshot() instanceof Container) {
            throw new SandboxException('Sandbox is not enabled.');
        }

        $shouldUseOb = $this->config->get('swoole_http.ob_output', true);

        if ($shouldUseOb) {
            return $this->prepareObResponse($request);
        }

        return $this->prepareResponse($request);
    }
452481
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);
        $details = ArrayObject::ensureArrayObject($request->getModel());

        $httpRequest = new GetHttpRequest();
        $this->gateway->execute($httpRequest);

        if ($this->api->verifyHash($httpRequest->request) === false) {
            throw new HttpResponse('0|CheckMacValue verify fail.', 400, ['Content-Type' => 'text/plain']);
        }

        $details->replace($httpRequest->request);

        throw new HttpResponse('1|OK', 200, ['Content-Type' => 'text/plain']);
    }
974870
public function run(Request $request)
    {
        $this->container = $this->container ?: new Container;
        
        try {
            if (! is_string($this->action['uses'])) {
                return $this->runCallable($request);
            }
            
            list($class, $method) = explode('@', $this->action['uses']);
            $cl = new ClassLoader;
            $cl->addPsr4($this->getAppNamespace(), app('path'));
            $file = $cl->findFile($class);
            $cmd = 'php -l ' . $file;
            
            if (strpos(exec($cmd, $output), 'No syntax errors detected') === false) {
                $route = array_get($this->action, 'as', $this->action['uses']);
                $error = head(array_filter($output));
                
                throw new SyntaxErrorException($route, $error);
            }
            
            set_error_handler([$this, 'error']);
            
            if ($this->customDispatcherIsBound()) {
                return $this->runWithCustomDispatcher($request);
            }
            
            return $this->runController($request);
        } catch (HttpResponseException $e) {
            return $e->getResponse();
        }
    }
687762
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);
        }
    }
1092794
public function doRequest($request)
    {
        $this->createApplication();
        $zendRequest = $this->application->getRequest();

        $uri = new HttpUri($request->getUri());
        $queryString = $uri->getQuery();
        $method = strtoupper($request->getMethod());

        $zendRequest->setCookies(new Parameters($request->getCookies()));

        $query = [];
        $post = [];
        $content = $request->getContent();
        if ($queryString) {
            parse_str($queryString, $query);
        }

        if ($method !== HttpRequest::METHOD_GET) {
            $post = $request->getParameters();
        }

        $zendRequest->setQuery(new Parameters($query));
        $zendRequest->setPost(new Parameters($post));
        $zendRequest->setFiles(new Parameters($request->getFiles()));
        $zendRequest->setContent($content);
        $zendRequest->setMethod($method);
        $zendRequest->setUri($uri);
        $requestUri = $uri->getPath();
        if (!empty($queryString)) {
            $requestUri .= '?' . $queryString;
        }

        $zendRequest->setRequestUri($requestUri);

        $zendRequest->setHeaders($this->extractHeaders($request));
        $this->application->run();

        // get the response *after* the application has run, because other ZF
        //     libraries like API Agility may *replace* the application's response
        //
        $zendResponse = $this->application->getResponse();

        $this->zendRequest = $zendRequest;

        $exception = $this->application->getMvcEvent()->getParam('exception');
        if ($exception instanceof \Exception) {
            throw $exception;
        }

        $response = new Response(
            $zendResponse->getBody(),
            $zendResponse->getStatusCode(),
            $zendResponse->getHeaders()->toArray()
        );

        return $response;
    }
329553
public function dispatch(Request $request)
    {
        $this->logger->debug('Dispatching request');
        try {
            /**
             * @var \Shade\Router\RouterInterface $router
             */
            $router = $this->serviceContainer->getService(ServiceContainer::SERVICE_ROUTER);
            $route = $router->route($request);
            if (!isset($this->primaryRequest)) {
                $this->primaryRequest = $request;
                $logMessage = 'Route found for primary request';
            } else {
                $logMessage = 'Route found for secondary request';
            }
            if (!isset($this->primaryRoute)) {
                $this->primaryRoute = $route;
            }
        } catch (Exception $e) {
            $this->logger->debug('Route not found');
            $response = new Response();
            $response->setCode(404);

            return $response;
        }

        $this->validateRoute($route);
        $this->logger->debug(
            $logMessage,
            [
                'controller' => $route->controller(),
                'action' => $route->action(),
                'args' => $route->args(),
            ]
        );
        $controllerClass = $route->controller();
        $actionName = $route->action();
        $actionArguments = $this->getMethodArguments($controllerClass, $actionName);

        if (method_exists($controllerClass, '__construct')) {
            $constructorArguments = $this->getMethodArguments($controllerClass, '__construct');
        }

        if (empty($constructorArguments)) {
            $controller = new $controllerClass();
        } else {
            $controllerReflection = new \ReflectionClass($controllerClass);
            $controller = $controllerReflection->newInstanceArgs($constructorArguments);
        }

        if (!($controller instanceof Controller)) {
            throw new Exception(
                "'{$controllerClass}' must inherit '\\Shade\\Controller'."
            );
        }

        /**
         * @var \Shade\Controller $controller
         */
        $controller->setControllerDispatcher($this);
        $controller->setView($this->serviceContainer->getService(ServiceContainer::SERVICE_VIEW));
        $controller->setCurrentRequest($request);
        $controller->setCurrentRoute($route);
        $controller->setPrimaryRequest($request);
        $controller->setPrimaryRoute($route);

        /**
         * @var Response $response
         */
        $response = call_user_func_array([$controller, $actionName], $actionArguments);
        if (!$response instanceof Response) {
            throw new Exception(
                "Executed controller hasn't returned instance of \\Shade\\Response. "
                .ucfirst(gettype($response)).' has been returned.'
            );
        }

        if (!$response->getCode()) {
            $response->setCode(200);
        }

        return $response;
    }
652358
public function run(Request $request) {
		$login = '';
		$error = '';
		$redirect = $request->headers->get('referer');
		$prefs = $this->getServiceContainer()->getPreferenceLoader()->getSystemPreferences();

		// try login
		if ($request->isMethod('POST')) {
			$login = $request->request->get('login');
			$password = $request->request->get('password');
			$redirect = rawurldecode($request->request->get('redirect'));

			$auth = $this->getServiceContainer()->getAuthManager();
			if ($auth->login($login, $password)) {
				$token = $auth->getSession()->getToken();
				$foward = $redirect ?: $prefs->getAccountUrl();
				$response = new RedirectResponse($foward);
				$this->getServiceContainer()->getKernel()->setCookie($response, AuthManager::COOKIE_TOKEN_NAME, $token);
				return $response;
			}

			$error = 'Invalid credentials';
		}

		$translator = $this->getServiceContainer()->getTranslator();
		$module = $this->getModule();
		$form = $module->getWidgetFactory()->createLoginWidget();
		$form = $form->build([
			'error' => $error,
			'destination' => $prefs->getAccountUrl() . '/' . $translator->trans('slug.login'),
			'redirect' => $redirect,
			'login' => $login
		]);

		return $this->responder->run($request, new Blank([
			'form' => $form
		]));
	}
271472
public function run(Request $request) {
		$file = $request->files->get('file');

		try {
			// validate: upload progress
			if (!$file->isValid()) {
				throw new FileException($file->getErrorMessage());
			}

			// validate: mime type
			$mimeTypes = ['image/png', 'image/jpeg', 'image/jpg', 'video/mp4', 'video/quicktime'];
			if (!in_array($file->getClientMimeType(), $mimeTypes)) {
				throw new FileException('No matching mime type');
			}

			// validate: extension
			$exts = ['png', 'jpg', 'jpeg', 'mp4', 'mov'];
			if (!in_array($file->getClientOriginalExtension(), $exts)) {
				throw new FileException('No matching extension');
			}

			// move uploaded file
			$slugifier = new Slugify();
			$fileName = $file->getClientOriginalName();
			$fileName = str_replace('.' . $file->getClientOriginalExtension(), '', $fileName);
			$fileName = $slugifier->slugify($fileName) . '.' . $file->getClientOriginalExtension();
			$file->move($this->getModule()->getUploadPath()->toString(), $fileName);
			$payload = new Success([
				'filename' => $fileName,
				'url' => $this->getModule()->getUploadUrl() . '/' . urlencode($fileName)
			]);
		} catch (FileException $e) {
			$payload = new Failed(['error' => $e->getMessage()]);
		}

		return $this->responder->run($request, $payload);
	}
989543
protected function runController(Request $request)
	{
		list($class, $method) = explode('@', $this->action['uses']);

		$parameters = $this->resolveClassMethodDependencies(
			$this->parametersWithoutNulls(), $class, $method
		);

		if ( ! method_exists($instance = $this->container->make($class), $method))
		{
			throw new NotFoundHttpException;
		}

		return call_user_func_array([$instance, $method], $parameters);
	}
679064
public function run(array $request)
    {
        $report = new Report;
        foreach ($request as $key => $value) {
            $report = $this->iterate($key, $value, $report);
        }
        return $report;
    }
613434
public function run(HttpRequest $request = null, HttpResponse $response = null)
    {
        if (false === $this->booted) {
            $this->boot();
        }

        if (null === $request) {
            $request = HttpRequest::createFromGlobals();
        }

        if (null === $response) {
            $response = new HttpResponse();
        }

        // Create a copy of request, as it's by-ref passed into $this->dispatch() and gets modified.
        $cleanRequest = clone $request;
        try {
            $response = $this->dispatch($request, $response);
        } catch (ResourceNotFoundException $e) {

            if($this->symfonyKernel === null) {
                throw $e;
            }
            $response = $this->symfonyKernel->handle($cleanRequest);
        }


        $response->send();

        return $response;
    }
320
public function run(Request $request) {
		$id = $this->getParam('id');
		$sport = SportQuery::create()
			->leftJoinGroup()
			->leftJoinSkill()
			->findOneById($id);

		$pictures = PictureQuery::create()
			->useSkillQuery()
				->filterBySportId($id)
			->endUse()
			->count();

		$videos = VideoQuery::create()
			->useSkillQuery()
				->filterBySportId($id)
			->endUse()
			->count();

		$references = ReferenceQuery::create()
			->useSkillReferenceQuery()
				->useSkillQuery()
					->filterBySportId($id)
				->endUse()
			->endUse()
			->count();

		$statistics = [
			'skills' => $sport->countSkills(),
			'groups' => $sport->countGroups(),
			'pictures' => $pictures,
			'videos' => $videos,
			'references' => $references
		];

		return $this->responder->run($request, new Blank($statistics));
	}
909005
public function execute($request)
	{
		$match = $this->lookup($request->getUrl()->getPath());
		$controller = $this->controller($match->getName());
		return $controller->execute(new RoutedRequest($request, $match, $this));
	}
882169
public function run(HTTPRequest $request) {
		$options = $request->getRoute()->getOptions();
		if( empty($options['render']) ) {
			throw new Exception('The StaticPageController requires a render option, add it to your routes configuration.');
		}
		return HTMLHTTPResponse::render($options['render']);
	}
363646
public function run($request)
    {
        // Loading packages and all their updates can be quite memory intensive.
        $memoryLimit = $this->config()->get('memory_limit');
        if ($memoryLimit) {
            if (Environment::getMemoryLimitMax() < Convert::memstring2bytes($memoryLimit)) {
                Environment::setMemoryLimitMax($memoryLimit);
            }
            Environment::increaseMemoryLimitTo($memoryLimit);
        }

        $composerLock = $this->getComposerLoader()->getLock();
        $rawPackages = array_merge($composerLock->packages, (array) $composerLock->{'packages-dev'});
        $packages = $this->getPackageInfo($rawPackages);

        // Get "name" from $packages and put into an array
        $moduleNames = array_column($packages, 'Name');

        $supportedPackages = $this->getSupportedPackages();
        $moduleHealthInfo = $this->getHealthIndicator($moduleNames);

        // Extensions to the process that add data may rely on external services.
        // There may be a communication issue between the site and the external service,
        // so if there are 'none' we should assume this is untrue and _not_ proceed
        // to remove everything. Stale information is better than no information.
        if ($packages) {
            // There is no onBeforeDelete for Package
            $table = DataObjectSchema::create()->tableName(Package::class);
            SQLDelete::create("\"$table\"")->execute();
            foreach ($packages as $package) {
                $packageName = $package['Name'];
                if (is_array($supportedPackages)) {
                    $package['Supported'] = in_array($packageName, $supportedPackages);
                }
                if (is_array($moduleHealthInfo) && isset($moduleHealthInfo[$packageName])) {
                    $package['Rating'] = $moduleHealthInfo[$packageName];
                }
                Package::create()->update($package)->write();
            }
        }
    }
1229018
public function handle(Request $request)
    {
        try {
            $this->loadConfiguration();

            // Now that Configuration is loaded let's resolve controller
            // for given request.
            $calls = $this->resolveController($request);
            $controller = $calls['controller'];
            $callable   = $calls['callable'];

            // Resolve arguments before calling controller
            $res = $controller->$callable();

            // Check if controller returned Response
            // and if so let's use it as our response
            if (is_a($res, 'Symfony\Component\HttpFoundation\Response')) {
                $this->response = $res;
            }

        } catch (\Exception $e) {
            $error = new \StdClass;
            $error->message = $e->getMessage();
            $error->code    = $e->getCode();
            $this->response->setStatusCode($e->getCode());
            $this->response->setContent(json_encode($error));
            $this->response->headers->set('Content-Type', 'application/json');
        }

        // Send response
        if ($request->getRequestFormat() == 'json') {
            $this->response->headers->set('Content-Type', 'application/json');
        }

        $this->response->send();

    }
614616
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

        $model = ArrayObject::ensureArrayObject($request->getModel());

        if (null === $model['error_code']) {
            $request->markNew();
            return;
        }

        if (self::SUCCESS === $model['error_code']) {
            $request->markCaptured();
            return;
        }

        $request->markFailed();

    }