/**
  * Generates the list page.
  *
  * @param \Symfony\Component\HttpFoundation\Request $request
  *
  * @return array
  */
 public function listAction(Request $request)
 {
     $limit = $request->get('limit', 10);
     $this->profiler->disable();
     $ip = $request->query->get('ip');
     $method = $request->query->get('method');
     $url = $request->query->get('url');
     $profiles = $this->profiler->find($ip, $url, $limit, $method, '', '');
     $rows = [];
     if (count($profiles)) {
         foreach ($profiles as $profile) {
             $row = [];
             $row[] = $this->l($profile['token'], new Url('webprofiler.dashboard', ['profile' => $profile['token']]));
             $row[] = $profile['ip'];
             $row[] = $profile['method'];
             $row[] = $profile['url'];
             $row[] = $this->date->format($profile['time']);
             $rows[] = $row;
         }
     } else {
         $rows[] = [['data' => $this->t('No profiles found'), 'colspan' => 6]];
     }
     $build = [];
     $storage_id = $this->config('webprofiler.config')->get('storage');
     $storage = $this->storageManager->getStorage($storage_id);
     $build['resume'] = ['#type' => 'inline_template', '#template' => '<p>{{ message }}</p>', '#context' => ['message' => $this->t('Profiles stored with %storage service.', ['%storage' => $storage['title']])]];
     $build['filters'] = $this->formBuilder()->getForm('Drupal\\webprofiler\\Form\\ProfilesFilterForm');
     $build['table'] = ['#type' => 'table', '#rows' => $rows, '#header' => [$this->t('Token'), ['data' => $this->t('Ip'), 'class' => [RESPONSIVE_PRIORITY_LOW]], ['data' => $this->t('Method'), 'class' => [RESPONSIVE_PRIORITY_LOW]], $this->t('Url'), ['data' => $this->t('Time'), 'class' => [RESPONSIVE_PRIORITY_MEDIUM]]], '#sticky' => TRUE];
     return $build;
 }
 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $config = $this->config('webprofiler.config');
     $form['purge_on_cache_clear'] = ['#type' => 'checkbox', '#title' => $this->t('Purge on cache clear'), '#description' => $this->t('Deletes all profiler files during cache clear.'), '#default_value' => $config->get('purge_on_cache_clear')];
     $storages = $this->storageManager->getStorages();
     $form['storage'] = ['#type' => 'select', '#title' => $this->t('Storage backend'), '#description' => $this->t('Choose were to store profiler data.'), '#options' => $storages, '#default_value' => $config->get('storage')];
     $form['exclude'] = ['#type' => 'textarea', '#title' => $this->t('Exclude'), '#default_value' => $config->get('exclude'), '#description' => $this->t('Paths to exclude for profiling. One path per line.')];
     $form['active_toolbar_items'] = ['#type' => 'checkboxes', '#title' => $this->t('Active toolbar items'), '#options' => $this->getCollectors(), '#description' => $this->t('Choose which items to show into the toolbar.'), '#default_value' => $config->get('active_toolbar_items')];
     $form['ide_link'] = ['#type' => 'textfield', '#title' => $this->t('IDE link'), '#description' => $this->t('IDE link for open files.'), '#default_value' => $config->get('ide_link')];
     $form['database'] = ['#type' => 'details', '#title' => $this->t('Database settings'), '#open' => FALSE, '#states' => array('visible' => array(array(':input[name="active_toolbar_items[database]' => array('checked' => TRUE))))];
     $form['database']['query_sort'] = ['#type' => 'radios', '#title' => $this->t('Sort query log'), '#options' => ['source' => 'by source', 'duration' => 'by duration'], '#description' => $this->t('The query table can be sorted in the order that the queries were executed or by descending duration.'), '#default_value' => $config->get('query_sort')];
     $form['database']['query_highlight'] = ['#type' => 'number', '#title' => $this->t('Slow query highlighting'), '#description' => $this->t('Enter an integer in milliseconds. Any query which takes longer than this many milliseconds will be highlighted in the query log. This indicates a possibly inefficient query, or a candidate for caching.'), '#default_value' => $config->get('query_highlight'), '#min' => 0];
     $storageId = $this->config('webprofiler.config')->get('storage');
     $storage = $this->storageManager->getStorage($storageId);
     $form['purge'] = ['#type' => 'details', '#title' => $this->t('Purge profiles'), '#open' => FALSE];
     $form['purge']['purge'] = ['#type' => 'submit', '#value' => $this->t('Purge'), '#submit' => [[$this, 'purge']]];
     $form['purge']['purge-help'] = ['#type' => 'inline_template', '#template' => '<div class="form-item">{{ message }}</div>', '#context' => ['message' => $this->t('Purge %storage profiles.', ['%storage' => $storage['title']])]];
     return parent::buildForm($form, $form_state);
 }