You are here

public function DashboardController::restCollectorAction in Devel 8

Same name and namespace in other branches
  1. 8.3 webprofiler/src/Controller/DashboardController.php \Drupal\webprofiler\Controller\DashboardController::restCollectorAction()
  2. 8.2 webprofiler/src/Controller/DashboardController.php \Drupal\webprofiler\Controller\DashboardController::restCollectorAction()
  3. 4.x webprofiler/src/Controller/DashboardController.php \Drupal\webprofiler\Controller\DashboardController::restCollectorAction()

Exposes collector's data as JSON.

Parameters

\Symfony\Component\HttpKernel\Profiler\Profile $profile:

$collector:

Return value

\Symfony\Component\HttpFoundation\JsonResponse

1 string reference to 'DashboardController::restCollectorAction'
webprofiler.routing.yml in webprofiler/webprofiler.routing.yml
webprofiler/webprofiler.routing.yml

File

webprofiler/src/Controller/DashboardController.php, line 236

Class

DashboardController
Class DashboardController

Namespace

Drupal\webprofiler\Controller

Code

public function restCollectorAction(Profile $profile, $collector) {
  $this->profiler
    ->disable();
  $data = $profile
    ->getCollector($collector)
    ->getData();
  return new JsonResponse([
    'data' => $data,
  ]);
}