You are here

private function BenchmarkCommand::getData in Devel 8.3

Same name and namespace in other branches
  1. 8 webprofiler/src/Command/BenchmarkCommand.php \Drupal\webprofiler\Command\BenchmarkCommand::getData()
  2. 8.2 webprofiler/src/Command/BenchmarkCommand.php \Drupal\webprofiler\Command\BenchmarkCommand::getData()
  3. 4.x webprofiler/src/Command/BenchmarkCommand.php \Drupal\webprofiler\Command\BenchmarkCommand::getData()

Parameters

\GuzzleHttp\ClientInterface $client:

$url:

Return value

array

1 call to BenchmarkCommand::getData()
BenchmarkCommand::execute in webprofiler/src/Command/BenchmarkCommand.php
Executes the current command.

File

webprofiler/src/Command/BenchmarkCommand.php, line 156

Class

BenchmarkCommand
Class BenchmarkCommand.

Namespace

Drupal\webprofiler\Command

Code

private function getData(ClientInterface $client, $url) {

  /** @var \GuzzleHttp\Message\ResponseInterface $response */
  $response = $client
    ->get($url);
  $token = $response
    ->getHeader('X-Debug-Token');

  /** @var \Drupal\webprofiler\Profiler\Profiler $profiler */
  $profiler = $this->container
    ->get('profiler');

  /** @var \Symfony\Component\HttpKernel\Profiler\Profile $profile */
  $profile = $profiler
    ->loadProfile($token);

  /** @var \Drupal\webprofiler\DataCollector\TimeDataCollector $timeDataCollector */
  $timeDataCollector = $profile
    ->getCollector('time');
  return new BenchmarkData($token, $timeDataCollector
    ->getMemory(), $timeDataCollector
    ->getDuration());
}