@param Request $request

@return Response
432674
public function listAction(Request $request)
    {
        $this->buildBreadcrumbs($this->getType());

        $queryBuilder = $this->getDoctrine()
            ->getManager()
            ->createQueryBuilder()
            ->select('e')
            ->from($this->getEntityName($this->getType()), 'e')
            ->orderBy('e.id', 'DESC');

        $adapter = new DoctrineORMAdapter($this->alterListQuery($queryBuilder));
        $data = new Pagerfanta($adapter);
        $data->setCurrentPage($request->query->get('page', 1));

        $module = $this->getModule($this->getType());

        return $this->render($this->getListTemplate(), array_merge(array(
            'data' => $data,
            'type' => $this->getType(),
            'module' => $module,
            'submodules' => $this->getSubmodules($module),
        ), $this->getExtraListVariables()));
    }
646466
public function request(Request $request) : Response
    {
        if (!$this->resource) {
            $this->resource = curl_init();
        }

        // options
        $options = [
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_HEADER => true,
        ];

        // gzip, deflate
        if ($this->options[self::OPTIONS_ACCEPT_ENCODING]) {
            if ($this->options[self::OPTIONS_ACCEPT_ENCODING] == true) {
                $options[CURLOPT_ENCODING] = ''; //force curl to send all Accept-Encoding available
            } else {
                $options[CURLOPT_ENCODING] = $this->options[self::OPTIONS_ACCEPT_ENCODING];
            }
        }

        // ssl
        if (isset($this->options[self::OPTIONS_SSL_VERIFY]) && $this->options[self::OPTIONS_SSL_VERIFY] === false) {
            $options[CURLOPT_SSL_VERIFYHOST] = false;
            $options[CURLOPT_SSL_VERIFYPEER] = false;
        }

        // timeout
        if ($this->options[self::OPTIONS_TIMEOUT]) {
            $options[CURLOPT_TIMEOUT_MS] = $this->options[self::OPTIONS_TIMEOUT];
        }

        if ($this->options[self::OPTIONS_CONNECT_TIMEOUT]) {
            $options[CURLOPT_CONNECTTIMEOUT_MS] = $this->options[self::OPTIONS_CONNECT_TIMEOUT];
        }

        // proxy
        if (!empty($this->options[self::OPTIONS_PROXY])) {
            $options[CURLOPT_PROXY] = $this->options[self::OPTIONS_PROXY];
        }

        // proxy
        if (!empty($this->options[self::OPTIONS_FOLLOW_REDIRECTION])) {
            $options[CURLOPT_FOLLOWLOCATION] = $this->options[self::OPTIONS_FOLLOW_REDIRECTION];

            if (!empty($this->options[self::OPTIONS_MAX_REDIRECTION])) {
                $options[CURLOPT_MAXREDIRS] = $this->options[self::OPTIONS_MAX_REDIRECTION];
            }
        }

        // debug temporary files
        if (!empty($this->options[self::OPTIONS_DEBUG])) {
            $options[CURLOPT_VERBOSE] = true;
            $options[CURLOPT_STDERR] = fopen('php://temp', 'rw');
        }

        // headers handling
        $headers = array_merge($this->defaultHeader, $request->getHeaders());

        // add cookie to current headers
        if ($request->getCookies()) {
            $cookies = [];
            foreach ($request->getCookies() as $name => $cookie) {
                $cookies[] = $name . '=' . urlencode($cookie->getValue());
            }

            $headers['Cookie'] = implode('; ', $cookies);
        }

        if ($headers) {
            $finalHeaders = [];
            foreach ($headers as $name => $value) {
                $finalHeaders[] = $name . ': ' . $value;
            }
            $options[CURLOPT_HTTPHEADER] = $finalHeaders;
        }

        // handle post
        $options[CURLOPT_CUSTOMREQUEST] = $request->getMethod();
        if ($request->getMethod() != 'GET') {
            if ($request->getPayload()) {
                $options[CURLOPT_POSTFIELDS] = $request->getPayload();
            } elseif ($request->getHeader('Content-Type') == 'multipart/form-data') {
                // as an array(): The data will be sent as multipart/form-data
                // which is not always accepted by the serve

                // There are "@" issue on multipart POST requests.
                $options[CURLOPT_SAFE_UPLOAD] = true;
                $options[CURLOPT_POSTFIELDS] = $request->getPosts();
            } else {
                // as url encoded string: The data will be sent as application/x-www-form-urlencoded,
                // which is the default encoding for submitted html form data.
                $options[CURLOPT_POSTFIELDS] = http_build_query($request->getPosts());
            }
        }

        // progress
        if ($this->progress) {
            $options[CURLOPT_NOPROGRESS] = false;
            $options[CURLOPT_PROGRESSFUNCTION] = $this->progress;
            $options[CURLOPT_BUFFERSIZE] = 1024;
        }

        // user & password
        if ($request->getUri()->getUser()) {
            $options[CURLOPT_USERPWD] = $request->getUri()->getUser() .
                ($request->getUri()->getPassword() ? ':' . $request->getUri()->getPassword() : '');
        }

        // final options
        $options[CURLOPT_URL] = $request->getUri()->get(false);

        curl_reset($this->resource);
        curl_setopt_array($this->resource, $options);

        // send request
        $requestEvent = new TimerEvent($this->options[self::OPTIONS_EVENTS_PREFIX] . '.request');
        $response = curl_exec($this->resource);
        $infos = curl_getinfo($this->resource);

        // request event
        $requestEvent->addData([
            'method' => $request->getMethod(),
            'url' => $request->getUri()->get(false),
            'code' => $infos['http_code'],
            'header size' => $infos['header_size'],
            'request size' => $infos['request_size'],
        ]);
        self::emit($requestEvent);

        // generate events for all duration
        $data = [
            'method' => $request->getMethod(),
            'url' => $request->getUri()->get(false),
            'code' => $infos['http_code'],
        ];

        $event = new ManualTimerEvent($this->options[self::OPTIONS_EVENTS_PREFIX] . '.nameLookup', $data);
        $event->setDuration($infos['namelookup_time'])
            ->setStart($requestEvent->getStart());
        self::emit($event);

        $event = new ManualTimerEvent($this->options[self::OPTIONS_EVENTS_PREFIX] . '.connect', $data);
        $event->setDuration($infos['connect_time'])
            ->setStart($requestEvent->getStart() + $infos['namelookup_time']);
        self::emit($event);

        // debug log
        if (!empty($this->options[self::OPTIONS_DEBUG])) {
            rewind($options[CURLOPT_STDERR]);
            $log = stream_get_contents($options[CURLOPT_STDERR]);

            if (isset($options[CURLOPT_POSTFIELDS]) && is_array($options[CURLOPT_POSTFIELDS])) {
                $log .= json_encode($log) . "\r\n";
            } elseif (isset($options[CURLOPT_POSTFIELDS])) {
                $log .= $options[CURLOPT_POSTFIELDS] . "\r\n";
            }

            if ($response) {
                $log = $log . "\r\n" . htmlentities(explode("\r\n\r\n", $response)[1]);
            }
            self::logger()->debug($log);
        }

        // connection error
        if ($response === false) {
            $code = curl_errno($this->resource);
            $message = curl_error($this->resource);

            throw new ConnectionException($request, $message, $code);
        }

        // final response
        $response = new Response($response);

        if ($response->getStatus() >= 400) {
            throw new RequestException($request, $response, $response->getStatus());
        }

        return $response;
    }
175216
public function createAction(Request $request): Response
    {
        $this->denyAccessUnlessGranted(new Attribute('class', 'create'));
        $form = $this->formFactory->createContentTypeGroup(
            new ContentTypeGroupCreateData()
        );
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (ContentTypeGroupCreateData $data) {
                $createStruct = $this->contentTypeService->newContentTypeGroupCreateStruct(
                    $data->getIdentifier()
                );
                $group = $this->contentTypeService->createContentTypeGroup($createStruct);

                $this->notificationHandler->success(
                    $this->translator->trans(
                        /** @Desc("Content type group '%name%' created.") */
                        'content_type_group.create.success',
                        ['%name%' => $data->getIdentifier()],
                        'content_type'
                    )
                );

                return new RedirectResponse($this->generateUrl('ezplatform.content_type_group.view', [
                    'contentTypeGroupId' => $group->id,
                ]));
            });

            if ($result instanceof Response) {
                return $result;
            }
        }

        return $this->render('@ezdesign/admin/content_type_group/create.html.twig', [
            'form' => $form->createView(),
        ]);
    }
882654
public function browseAction(Request $request)
    {
        $response = $this->convertResourceToPlainText(
            $request->getRequestFormat('xml'),
            $this->mapper->getCollection()
        );

        return new Response($response);
    }
976047
public function handle(Request $request)
	{
		// execute response
		$response = $this->next($request);

		// only do on json data
		if (!$response->isJson())
		{
			return $response;
		}

		// get the response content and json decode
		$content = json_decode($response->getContent());

		// get date keys from response options
		$this->dateKeys = array_merge(
			$this->dateKeys,
			$response->getTransformKeys('dates')
		);

		// make sure to handle array different then a single object
		if (is_array($content))
		{
			// loop through each item in array and covert dates
			foreach ($content as $key => $value)
			{
				$content[$key] = $this->convertDateKeysInObjects($value);
			}
		}
		else
		{
			// convert single object dates
			$content = $this->convertDateKeysInObjects($content);
		}

		// set the response content to modified content
		$response->setContent(json_encode($content));

		// return response
		return $response;
	}
907356
public function requestAction(Request $request)
    {
        $widget = $request->isXmlHttpRequest();

        $form = $this->getPasswordResetTokenFormFactory()->createRequestForm()->handleRequest($request);

        if (!$form->isSubmitted()) {
            return new Response($this->getPasswordResetTokenFormRenderer()->renderRequestForm($widget, $form));
        }

        $successMessage = 'password_reset_token.action.request.success';

        $passwordResetToken = $this->getPasswordResetTokenFormHandler()->handleRequestForm($form, !$widget, $successMessage);

        if (empty($passwordResetToken)) {
            $html = $this->getPasswordResetTokenFormRenderer()->renderRequestForm($widget, $form);

            return $widget
                ? new AjaxResponse($html, false, FlashNotifierInterface::MESSAGE_FORM_ERROR)
                : new Response($html);
        }
        if ($widget) {
            $webmailLink   = null;
            $webmailLinker = $this->getWebmailLinker();

            if (!empty($webmailLinker)) {
                $webmailLink = $webmailLinker->getProviderByEmailAddress($passwordResetToken->getUser()->getEmail());
            }

            return new AjaxResponse(
                $this->renderView('DarvinUserBundle:PasswordResetToken/widget/request:submitted.html.twig', [
                    'password_reset_token' => $passwordResetToken,
                    'webmail_link'         => $webmailLink,
                ]),
                true,
                $successMessage
            );
        }

        return $this->redirectToRoute('darvin_user_security_login');
    }
1328229
public function send(Request $request)
    {
        $response     = new SearchResponse();
        $httpRequest  = $this->createHttpRequest($request);
        $httpResponse = $this->client->send($httpRequest);
        $json         = $httpResponse->json();
        $result       = $json['response'];

        $response->docs     = $result['docs'];
        $response->numFound = $result['numFound'];
        $response->maxScore = $result['maxScore'];
        $response->docs     = array_map([$this, 'docToArray'], $result['docs']);

        return $response;
    }
264037
public function handle(Request $request)
    {
        $pathInfo = $request->getPathInfo();

        if (0 === strpos($pathInfo, $this->basePath)) {
            foreach ($this->routes as $config) {
                list($method, $pattern, $controller) = $config;

                if ($request->getMethod() === strtoupper($method)
                    && preg_match('!^' . preg_quote($this->basePath . $pattern, '!') . '$!', $request->getPathInfo())
                ) {
                    return call_user_func($controller, $request);
                }
            }
        }

        return null;
    }
265971
public function render(?Request $request = null): Response {
        $request = self::validateRequest($request);

        $translator = $this->translatorProvider->getPreferredTranslator(
            $request->getLanguages(),
            $this->config['default_language']
        );

        $response = new Response();

        $response->setContent($this->templateRenderer->render(
            $this->config['template_name'],
            array_merge($translator->getTranslations(), [
                'lang' => $translator->getLanguage(),
                'charset' => $this->config['charset']
            ])
        )."\n<!-- Powered by progminer/maintenance-screen (https://packagist.org/packages/progminer/maintenance-screen) -->\n");
        $response->headers->set('Content-Language', $translator->translate('lang'));

        return $response;
    }
736124
public function postAction(Request $request)
    {
        $type = 'page';
        $language = $this->getLanguage($request);
        $action = $request->get('action');

        $this->checkActionParameterSecurity($action, $language);

        $document = $this->getDocumentManager()->create($type);
        $formType = $this->getMetadataFactory()->getMetadataForAlias($type)->getFormType();

        $this->persistDocument($request, $formType, $document, $language);
        $this->handleActionParameter($action, $document, $language);
        $this->getDocumentManager()->flush();

        $context = new Context();
        $context->setGroups(['defaultPage']);

        return $this->handleView($this->view($document)->setContext($context));
    }
560005
protected function search(Request $request)
    {
        $allResults = $this->repository->search($request->all());
        return Response::apiResponse([
            'data' => $allResults
        ]);
    }
1037159
public function handle(Request $request): Response
    {
        $handlers = $this->findAvailableHandlers();

        if ($command = $this->getArgument('command')) {
            return $this->displayHelpForCommand($handlers, $command);
        }

        return $this->displayListOfAllCommands($handlers);
    }
72717
public function dispatch(Request $request)
    {
        /** @var DispatcherInterface $dispatcher */
        $dispatcher = $this->make(DispatcherInterface::class);

        return $dispatcher->dispatch($request);
    }
364037
protected function getCallbackFromRequest(Request $request)
    {
        $response = new JsonResponse('');
        $response->setCallback($request->query->get(self::PARAMETER_CALLBACK));

        return $response->getCallback();
    }
1221396
public function send(Request $request)
    {
        $response   = new DeleteResponse();
        $rpbPutReq  = $this->createRpbMessage($request);

        $this->client->send($rpbPutReq, RiakMessageCodes::DEL_REQ, RiakMessageCodes::DEL_RESP);

        return $response;
    }
234684
public function addAction(Request $request)
    {
        $resource = $this->mapper->create($this->validateRequestParameters($request));

        return new Response('', 201, array('Location' => $this->mapper->generateReadUrl($resource)));
    }
1279098
public function sendRequest(Request $request)
    {
        $response = $this->httpClient->send($request);

        $this->checkErrorResponse($response);

        return $response;
    }