Generates response for current request based on it's type

@param string $view
@param array  $params

@return \DevGroup\AdminUtils\response\AjaxResponse|string
340409
public function renderResponse($view, $params = [])
    {
        /** @var \DevGroup\AdminUtils\controllers\BaseController $context */
        $context = $this instanceof Action ? $this->controller : $this;
        if (Yii::$app->request->isAjax === true) {
            Yii::$app->response->format = Response::FORMAT_JSON;

            $content = $context->renderAjax($view, $params);
            return new AjaxResponse($content, false, Yii::$app->session->getAllFlashes(true));
        } else {
            return $context->render($view, $params);
        }
    }
955388
public function settingsPostAction(Request $request, View $view)
    {
        $em = $this->getDoctrine()->getManager();

        $pageSeo = $view->getSeo() ?: new PageSeo();
        $form = $this->createSettingsForm($pageSeo, $view);

        $form->handleRequest($request);
        $novalidate = $request->query->get('novalidate', false);

        if (false === $novalidate && $form->isValid()) {
            $em->persist($pageSeo);
            $view->setSeo($pageSeo);
            $em->persist($view);
            $em->flush();

            $this->get('victoire_core.current_view')->setCurrentView($view);
            $this->congrat('victoire_seo.save.success');

            $response = [
                'success' => true,
                'url'     => $this->getViewUrl($view),
            ];
        } else {
            $response = $this->getNotPersistedSettingsResponse($form, $view, $novalidate);
        }

        return new JsonResponse($response);
    }
1056814
protected function renderResponse($view, array $parameters = array(), Response $response = null)
    {
        return $this->get('templating')->renderResponse($view, $parameters, $response);
    }
1085130
public function make($view, $data = array(), $options = array()) {

        $engine = $this->composer;
        $composer = new $engine(app_path($this->views), $options);

        // return
        $output = $composer->render($this->viewPath($view), $data);
        $this->response->body($output);
        $this->response->send();
    }
809472
private function render($view, array $parameters = [])
    {
        $response = new LegacyResponse();
        $response->setContent($this->templateEngine->render($view, $parameters));

        return $response;
    }
532377
protected function parseView($view)
    {
        if (is_string($view)) {
            return array($view, null, null);
        }

        // If the given view is an array with numeric keys, we will just assume that
        // both a "pretty" and "plain" view were provided, so we will return this
        // array as is, since must should contain both views with numeric keys.
        if (is_array($view) && isset($view[0])) {
            return array($view[0], $view[1], null);
        }

        // If the view is an array, but doesn't contain numeric keys, we will assume
        // the the views are being explicitly specified and will extract them via
        // named keys instead, allowing the developers to use one or the other.
        else if (is_array($view)) {
            return array(
                Arr::get($view, 'html'),
                Arr::get($view, 'text'),
                Arr::get($view, 'raw'),
            );
        }

        throw new \InvalidArgumentException("Invalid view.");
    }
920611
public function renderResponse($view, array $parameters = array(), Response $response = null)
    {
        if (null === $response) {
            $response = new Response();
        }

        $response->setContent($this->render($view, $parameters));

        return $response;
    }
996642
public function render($view, array $parameters = array(), Response $response = null)
    {
        if ($response === null) {
            $response = new Response();
        }

        $json = Encoder::encodeFromFile($this->getPath($view), $parameters);
        $response->setContent($json);

        return $response;
    }
784391
public function renderWithExtraParams($view, array $parameters = [], Response $response = null)
    {
        if (!$this->isXmlHttpRequest()) {
            $parameters['breadcrumbs_builder'] = $this->get('sonata.admin.breadcrumbs_builder');
        }
        $parameters['admin'] = $parameters['admin'] ??
            $this->admin;

        $parameters['base_template'] = $parameters['base_template'] ??
            $this->getBaseTemplate();

        $parameters['admin_pool'] = $this->get('sonata.admin.pool');

        //NEXT_MAJOR: Remove method alias and use $this->render() directly.
        return $this->originalRender($view, $parameters, $response);
    }
478959
public function createResponse(View $view, Request $request, $format)
    {
        $route = $view->getRoute();

        $location = $route
            ? $this->urlGenerator->generate($route, (array) $view->getRouteParameters(), UrlGeneratorInterface::ABSOLUTE_URL)
            : $view->getLocation();

        if ($location) {
            return $this->createRedirectResponse($view, $location, $format);
        }

        $response = $this->initResponse($view, $format);

        if (!$response->headers->has('Content-Type')) {
            $mimeType = $request->attributes->get('media_type');
            if (null === $mimeType) {
                $mimeType = $request->getMimeType($format);
            }

            $response->headers->set('Content-Type', $mimeType);
        }

        return $response;
    }
420263
public function get($view)
    {
        $url = UrlHelper::buildUrl(Urls::URL_VIEW, [$view]);

        $response = $this->getConnection()->get($url);
        $data = $response->getJson();

        $result = new View($data[View::ENTRY_NAME], $data[View::ENTRY_TYPE]);
        $result->setId($data[View::ENTRY_ID]);

        return $result;
    }
792323
public function render($view = null, $data = array())
    {
        if (is_null($view)) {
            $view = static::$defaultView;
        }

        $data = array_merge($data, array(
            'paginator' => $this,
            'elements'  => $this->elements(),
        ));

        return new HtmlString(
            static::viewFactory()->make($view, $data)->render()
        );
    }
1089828
protected function render($view, array $data = [])
    {
        // Extract variables.
        extract($data);

        // Start buffering.
        ob_start();

        // Load view file (root location is declared in viewPath var).
        include $this->container->get('config')['viewsPath'] . '/' . $view . '.php';

        // Get buffered content
        $body = ob_get_contents();
        ob_end_clean();

        // Make response and add body to it
        $response = new Response();
        $response->writeBody($body);
        return $response;
    }
810526
function viewResult( $view = '' )
    {
        if ( $view == '' )
            $view = $this->currentView();
        if ( isset( $this->ViewResult[$view] ) )
        {
            return $this->ViewResult[$view];
        }
        return null;
    }
393074
public function render($view_file, array $params = array())
    {
        $this->content = Helper::renderView(
            $view_file,
            array_merge($this->getDefaultViewParams(), $params)
        );
    }
290878
public function view($view, $data = [], $status = 200, array $headers = [])
    {
        respondWith(response()->view($view, $data, $status, $headers ));
    }
392556
public function output($view = null, $return = false) {
        if ($view instanceof View) {
            $this->view = $view;
        } else if (is_string($view) || is_bool($view) || is_numeric($view)) {
            $this->view = new SimpleView ($view);
        } else if (is_array($view)) {
            $this->view = new JsonView ($view);
        } else if (is_object($view)) {
            $this->view = new JsonView (get_object_vars($view));
        }

        if ($this->view instanceof View) {
            if ($return) {
                $content = $this->view->render();

                return $content;
            } else {
                $this->view->echoHeader();
                $content = $this->view->render();
                if (is_string($content) && $content) {
                    $content = apply_filter('before_output_content', $content, $this->view);
                    echo $content;
                }
            }
        } else if (!$return) {
            Response::respond(404);
        }

        return null;
    }