Create an instance of an appropriate DebugView object.

@param HTTPRequest $request Optional request to target this view for
@return DebugView
973863
public static function create_debug_view(HTTPRequest $request = null)
    {
        $service = static::supportsHTML($request)
            ? DebugView::class
            : CliDebugView::class;
        return Injector::inst()->get($service);
    }
77885
public function openAction(Request $request)
    {
        if (null === $this->baseDir) {
            throw new NotFoundHttpException('The base dir should be set.');
        }

        if ($this->profiler) {
            $this->profiler->disable();
        }

        $file = $request->query->get('file');
        $line = $request->query->get('line');

        $filename = $this->baseDir.\DIRECTORY_SEPARATOR.$file;

        if (preg_match("'(^|[/\\\\])\.'", $file) || !is_readable($filename)) {
            throw new NotFoundHttpException(sprintf('The file "%s" cannot be opened.', $file));
        }

        return new Response($this->twig->render('@WebProfiler/Profiler/open.html.twig', [
            'filename' => $filename,
            'file' => $file,
            'line' => $line,
         ]), 200, ['Content-Type' => 'text/html']);
    }
436148
public function show(Request $request)
    {
        $this->validate($request, [
            'domain' => 'required|string'
        ]);

        $dns = DNS::where('meta', $request->domain)->orderBy('created_at', 'desc')->get();

        if (! count($dns)) {
            return redirect(route('eyewitness.dashboard').'#dns')->withError('Sorry - we could not find any DNS history for that domain. If you have just added the record, you should wait for the first test to run (usaully within an hour).');
        }

        return view('eyewitness::dns.show')->withEye(app(Eye::class))
                                           ->withDomain($request->domain)
                                           ->withDns($dns);
    }
21710
protected function get($request)
    {
        if (!isset($request['id'])) {
            throw new DebugBarException("Missing 'id' parameter in 'get' operation");
        }
        return $this->debugBar->getStorage()->get($request['id']);
    }
828392
public function showAction(Request $request, $exception, DebugLoggerInterface $logger = null)
    {
        $currentContent = $this->getAndCleanOutputBuffering($request->headers->get('X-Php-Ob-Level', -1));
        $code = $this->getStatusCode($exception);
        $templateData = $this->getTemplateData($currentContent, $code, $exception, $logger);

        $view = $this->createView($exception, $code, $templateData, $request, $this->showException);
        $response = $this->viewHandler->handle($view);

        return $response;
    }
980314
public static function copy(HttpRequest $request)
    {
        return new self(
            $request->getHost(),
            $request->getUri(),
            $request->getMethod(),
            $request->getHeaders(),
            $request->getBody()
        );
    }
856662
public function create(PageRequest $request)
    {

        $page = $this->repository->newInstance([]);
        return $this->response->setMetaTitle(trans('app.new') . ' ' . trans('page::page.name')) 
            ->view('page::page.create', true) 
            ->data(compact('page'))
            ->output();
    }
241690
public function createsnapshot(SS_HTTPRequest $request) {
		// Performs canView permission check by limiting visible projects
		$project = $this->getCurrentProject();
		if(!$project) {
			return new SS_HTTPResponse("Project '" . Convert::raw2xml($request->latestParam('Project')) . "' not found.", 404);
		}

		if(!$project->canBackup()) {
			return new SS_HTTPResponse("Not allowed to create snapshots on any environments", 401);
		}

		return $this->customise(array(
			'Title' => 'Create Data Snapshot',
			'Project' => $project,
			'CurrentProject' => $project,
			'SnapshotsSection' => 1,
			'DataTransferForm' => $this->getDataTransferForm($request)
		))->renderWith(array('DNRoot_createsnapshot', 'DNRoot'));
	}
999396
public function directCreateAction(Request $request)
    {
        $filter = new Filter();
        $filter->setName($request->request->get('filter_name'));
        $filter->setDescription($request->request->get('filter_description'));
        $filter->setState($request->request->getBoolean('filter_public') ? FilterStateEnum::ALL : FilterStateEnum::SELF);
        $filter->setCreatorUsername($this->getUser()->getUsername());

        $filter->setRoute($request->request->get('filter_route'));
        $filter->setArguments(json_decode($request->request->get('filter_route_arguments'), true));
        $filter->setConditions(json_decode($request->get('filter_conditions'), true));

        if (!is_array($filter->getConditions()) || !is_array($filter->getArguments())) {
            throw new BadRequestHttpException();
        }

        if ($this->router->getRouteCollection()->get($filter->getRoute()) === null) {
            throw new BadRequestHttpException();
        }

        $this->entityManager->persist($filter);
        $this->entityManager->flush();

        return $this->redirect($this->router->generate(
            $filter->getRoute(),
            array_merge($filter->getArguments(), $filter->getConditions())
        ));
    }
227339
public function run(HTTPRequest $request) {
		if( !DEV_VERSION ) {
			throw new ForbiddenException("You're not allowed to access to this content.");
		}
		$pathValues = $request->getPathValues();
		$cache = new APCache('delayedpage', $pathValues->page);
		$content = null;
		if( !$cache->get($content) ) {
			$cache->clear();
			throw new NotFoundException('The delayed page "'.$pathValues->page.'" was not found');
		}
		return new HTMLHTTPResponse($content);
	}
573094
final public function generateResponse($request = null)
    {
        while (true) {
            $this->setWebRequest($request);

            try {
                if ($request->header("Accept") == "application/leaf") {
                    $response = new XmlResponse($this);
                    $response->setContent($this->renderXhr());
                } else {
                    $response = new HtmlResponse($this);
                    $response->setContent($this->render());
                }

                return $response;
            } catch (RequiresViewReconfigurationException $er) {
                $this->initialiseView();
            }
        }

        return null;
    }
814904
public function view($request) {
		$object = null;
		if ($id = $request->param('ID')) {
			$object = ExternalContent::getDataObjectFor($id);
			if ($object instanceof ExternalContentSource) {
				$object = $object->getRoot();
			}

			if ($object && ($object instanceof ExternalContentItem || $object instanceof ExternalContentSource)) {
				$this->data()->setRequestedItem($object);
				$type = $object instanceof ExternalContentItem ? $object->getType() : 'source';
				$template = 'ExternalContent_' . get_class($object) . '_' . $type;

				$viewer = new SSViewer(array($template, 'ExternalContent_' . get_class($object), 'ExternalContent', 'Page'));
				$action = 'view';
				$this->extend('updateViewer', $action, $viewer);

				return $this->customise($object)->renderWith($viewer);
			}
		}

		echo "Template not found for " . ($object ? get_class($object) . ' #' . $object->ID : '');
	}
336882
public function execute(ViewPostRequest $request)
    {
        $post = $this->repository->findById(new PostId($request->getId()));

        if (null === $post) {
            throw new PostDoesNotExistException();
        }

        return $post;
    }
1097801
public function showAction(Request $request)
    {
        $treeId = (int) $request->get('tree_id');
        $teaserId = (int) $request->get('teaser_id');

        $dispatcher = $this->get('event_dispatcher');
        $teaserManager = $this->get('phlexible_teaser.teaser_manager');

        $teaser = $teaserManager->find($teaserId);
        $teaser->removeHideId($treeId);

        $beforeEvent = new TeaserEvent($teaser);
        if ($dispatcher->dispatch(TeaserEvents::BEFORE_SHOW_TEASER, $beforeEvent)->isPropagationStopped()) {
            throw new RuntimeException('Show cancelled by event');
        }

        $teaserManager->updateTeaser($teaser);

        $event = new TeaserEvent($teaser);
        $dispatcher->dispatch(TeaserEvents::SHOW_TEASER, $event);

        return new ResultResponse(true, 'Teaser will be displayed.');
    }
307655
public function detectScope(Request $request){

        $firstSegment = $this->getFirstSegment($request);

        try {
            return $this->repository->getByPathPrefix($firstSegment);
        } catch(OutOfBoundsException $e) {}

        try {
            return $this->repository->get(TreeScope::DEFAULT_NAME);
        } catch(OutOfBoundsException $e) {
            return new TreeScope;
        }

    }
262373
public function uploadsnapshot(SS_HTTPRequest $request) {
		// Performs canView permission check by limiting visible projects
		$project = $this->getCurrentProject();
		if(!$project) {
			return new SS_HTTPResponse("Project '" . Convert::raw2xml($request->latestParam('Project')) . "' not found.", 404);
		}

		if(!$project->canUploadArchive()) {
			return new SS_HTTPResponse("Not allowed to upload", 401);
		}

		return $this->customise(array(
			'Project' => $project,
			'CurrentProject' => $project,
			'SnapshotsSection' => 1,
			'UploadLimit' => $maxSize = File::format_size(min(
				File::ini2bytes(ini_get('upload_max_filesize')),
				File::ini2bytes(ini_get('post_max_size'))
			)),
			'UploadSnapshotForm' => $this->getUploadSnapshotForm($request),
			'PostSnapshotForm' => $this->getPostSnapshotForm($request)
		))->renderWith(array('DNRoot_uploadsnapshot', 'DNRoot'));
	}
349455
public function create(Request $request)
    {
        if ($request->wantsJson()) {
            return $this->validNotFoundJsonResponse();
        }

        $model = new $this->repository->model;

        $view = $this->getViewLocation(__FUNCTION__);
        $this->checkViewExists($view);

        return response()->view($view, compact('model'));
    }