You are here

public function RequestController::build in MongoDB 8.2

Controller.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The current request.

string $uniqueId: The unique request id from mod_unique_id. Unsafe.

Return value

array A render array.

1 string reference to 'RequestController::build'
mongodb_watchdog.routing.yml in modules/mongodb_watchdog/mongodb_watchdog.routing.yml
modules/mongodb_watchdog/mongodb_watchdog.routing.yml

File

modules/mongodb_watchdog/src/Controller/RequestController.php, line 88

Class

RequestController
The controller for the request events page.

Namespace

Drupal\mongodb_watchdog\Controller

Code

public function build(Request $request, string $uniqueId) : array {
  if (!preg_match('/^[-\\w@]+$/', $uniqueId)) {
    throw new NotFoundHttpException('Request ID is not well-formed.');
  }
  $events = $this
    ->getRowData($request, $uniqueId);
  if (empty($events)) {
    $top = NULL;
    $main = $this
      ->buildEmpty($this
      ->t('No events found for this request.'));
  }
  else {
    [
      ,
      $first,
    ] = reset($events);
    $top = $this
      ->getTop($uniqueId, $first);
    $main = $this
      ->buildMainTable($events);
  }
  $ret = $this
    ->buildDefaults($main, $top);
  return $ret;
}