Commit 02337b83 authored by Daniel Cothran's avatar Daniel Cothran
Browse files

Update the controller so that PhpStan checks pass.

parent 43f05877
Loading
Loading
Loading
Loading
Loading
+5 −5
Changes for src/Controller/ViewsShareController.php: 5 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ class ViewsShareController extends ControllerBase {
   */
  public function preview(string $view_id, string $display_id, Request $request): Response {
    $view = Views::getView($view_id);
    if (!$view) {
    if (!$view || !$view->access($display_id)) {
      return new Response('View not found.', 404);
    }

@@ -367,10 +367,10 @@ class ViewsShareController extends ControllerBase {
   * @param \Symfony\Component\HttpFoundation\Request $request
   *   The request.
   *
   * @return \Symfony\Component\HttpFoundation\Response
   * @return \Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\Response
   *   The oEmbed data as JSON.
   */
  public function oembed(string $view_id, string $display_id, Request $request): Response {
  public function oembed(string $view_id, string $display_id, Request $request): JsonResponse|Response {
    $view = Views::getView($view_id);
    if (!$view || !$view->access($display_id)) {
      return new JsonResponse(['error' => 'Access denied'], 403);
@@ -417,7 +417,7 @@ class ViewsShareController extends ControllerBase {
    }

    // Get the format to return based on user's selected input.
    $format = $request->get('format');
    $format = $request->query->get('format');
    if ($format === 'xml') {
      // Convert the oEmbed data to XML format.
      $xml = new \SimpleXMLElement('<oembed/>');
@@ -448,7 +448,7 @@ class ViewsShareController extends ControllerBase {
   */
  public function modal(string $view_id, string $display_id, Request $request): Response {
    $view = Views::getView($view_id);
    if (!$view) {
    if (!$view || !$view->access($display_id)) {
      return new Response('View not found.', 404);
    }