渲染视图

@param  string        $viewFile
@param  array         $parameters
@param  Response|null $response
@return Response
@throws \Exception
350799
public function render($viewFile, $parameters = [], Response $response = null)
    {
        if (null === $response) {
            $response = new Response();
        }

        return $response->setContent($this->getContent($viewFile, $parameters));
    }
952098
public function prepare ()
		{
			if (is_array($this->viewData)) {
				foreach ($this->viewData as $_token => $_value) {
					if (is_object($_value) && is_subclass_of($_value, __CLASS__)) {
						$$_token = $_value->prepare();
					} else {
						$$_token = $_value;
					}
				}
			}

			if (is_file($this->filePath)) {
				ob_start();
				require($this->filePath);

				return ob_get_clean();

			} else {
				throw new ViewFileNotFoundException('No such view: ' . $this->filePath);
			}
		}
328192
protected function renderAction(array $parameters = [], Action $action = null)
    {
        $response = new Response();
        $response->setContent($this->getTemplate($action)->render($parameters));

        return $response;
    }
4665
public function viewWithPayload()
    {
        return function (string $view, PayloadContract $payload, string $key = 'payload') {
            return ResponseFactory::view($view, [$key => $payload->getUnwrappedOutput()], $payload->getStatus());
        };
    }
832635
protected function render($viewPath, array $params = [])
    {
        if (!isset($params['title'])) {
            $params['title'] = $this->title;
        }
        $views = \pwf\basic\Application::$instance->getConfigParam('views');

        return $this->getView()->render($views.$viewPath, $params);
    }
1330334
public function renderResponse(BlockInterface $block, array $parameters = array(), Response $response = null)
    {
        $view = $this->getView($block);

        if ($response) {
            $this->setResponseHeaders($block, $response);
        }

        return $this->blockRenderer->render($view, $parameters, $response);
    }
128241
public function render($view, array $parameters = [], Response $response = null)
    {
        $parameters['media_pool'] = $this->get('sonata.media.pool');
        $parameters['persistent_parameters'] = $this->admin->getPersistentParameters();

        return parent::renderWithExtraParams($view, $parameters, $response);
    }
1171233
public static function view($path, $model = null) {
        if (($viewPath = PathUtility::getViewFilePath($path)) !== false) {
            $viewResult = new ViewResult($viewPath, $model);
            $viewContext = InternalHelper::makeViewContext(
                $viewPath, 
                self::$viewContext,
                $viewResult,
                $model,
                null,
                self::$parentActionViewContext,
                self::$viewContext,
                null
            );

            return $viewContext->content; //InternalHelper::getViewContent($viewPath, self::$viewContext, $model);
        }
        else {
            throw new ViewNotFoundException($path);
        }
    }
926631
public function renderJs($viewFile, $params = [], $pos = null)
    {
        $params['widget'] = $this;
        $js = $this->view->render($viewFile, $params);
        $this->registerJs($js, $pos);
    }
1309339
public final function view(string $file, array $content = null, bool $useViewPartials = null): void
    {
        if (!$this->useView) {
            throw new ServiceException("Set \$useView = true in service and be sure that already ".
                "included 'froq/froq-view' module via Composer");
        }

        $data = (array) ($content['data'] ?? []);
        $meta = (array) ($content['meta'] ?? []);

        // set meta if provided
        if ($meta != null) {
            foreach ($meta as $name => $value) {
                $this->view->setMeta($name, $value);
            }
        }

        $this->view->setFile($file);

        // override on runtime calls
        $useViewPartials = $useViewPartials ?? $this->useViewPartials;

        // set header/footer partials if uses
        if ($useViewPartials) {
            $this->view->setFileHead();
            $this->view->setFileFoot();
        }

        $this->view->display($data);
    }
932112
protected function render($view, array $parameters = array(), Response $response = null)
    {
        return $this->app->render($view, $parameters, $response);
    }
657509
public function render($view, array $parameters = [], Response $response = null)
    {
        return $this->templating->renderResponse($view, $parameters, $response);
    }
360670
private function initResponse(View $view, $format)
    {
        $content = null;
        if ($this->isFormatTemplating($format)) {
            $content = $this->renderTemplate($view, $format);
        } elseif ($this->serializeNull || null !== $view->getData()) {
            $data = $this->getDataFromView($view);

            if ($data instanceof FormInterface && $data->isSubmitted() && !$data->isValid()) {
                $view->getContext()->setAttribute('status_code', $this->failedValidationCode);
            }

            $context = $this->getSerializationContext($view);
            $context->setAttribute('template_data', $view->getTemplateData());

            $content = $this->serializer->serialize($data, $format, $context);
        }

        $response = $view->getResponse();
        $response->setStatusCode($this->getStatusCode($view, $content));

        if (null !== $content) {
            $response->setContent($content);
        }

        return $response;
    }
310570
public function build($viewName, $viewTemplateFile = '', ...$options) {
        if (!$viewName) {
            throw new \chilimatic\lib\exception\ViewException('No view name was selected');
        }

        $viewFactory = $this->getViewFactory();
        /**
         * @var \chilimatic\lib\view\AbstractView $view
         */
        $view = $viewFactory->make($viewName);
        $view->setConfigVariable('templateFile', $viewTemplateFile);

        $view->set();

    }
497059
public static function render(ResponseInterface $response, $view, array $params = [])
    {
        return Application::getInstance()->view->render($response, $view, $params);
    }
520994
protected function get($path, array $parameters = array(), $requestHeaders = array()) {
    if ($this->count !== NULL && !isset($parameters['count'])) {
      $parameters['count'] = $this->count;
    }
    $response = $this->client->getHttpClient()->get($path, $parameters, $requestHeaders);

    return ResponseMediator::getContent($response);
  }
1288188
public function get(string $path, array $parameters = [], array $requestHeaders = [])
    {
        if (null !== $this->page && !isset($parameters['page'])) {
            $parameters['page'] = $this->page;
        }
        if (null !== $this->perPage && !isset($parameters['per_page'])) {
            $parameters['per_page'] = $this->perPage;
        }
        if (array_key_exists('ref', $parameters) && is_null($parameters['ref'])) {
            unset($parameters['ref']);
        }
        if (count($parameters) > 0) {
            $path .= '?' . http_build_query($parameters);
        }

        $response = $this->getHttpClient()->get($path, $requestHeaders);

        return ResponseMediator::getContent($response);
    }