You are here

public function ServicesDataCollector::collect in Devel 4.x

Same name and namespace in other branches
  1. 8.3 webprofiler/src/DataCollector/ServicesDataCollector.php \Drupal\webprofiler\DataCollector\ServicesDataCollector::collect()
  2. 8 webprofiler/src/DataCollector/ServicesDataCollector.php \Drupal\webprofiler\DataCollector\ServicesDataCollector::collect()
  3. 8.2 webprofiler/src/DataCollector/ServicesDataCollector.php \Drupal\webprofiler\DataCollector\ServicesDataCollector::collect()

File

webprofiler/src/DataCollector/ServicesDataCollector.php, line 36

Class

ServicesDataCollector
Class ServicesDataCollector.

Namespace

Drupal\webprofiler\DataCollector

Code

public function collect(Request $request, Response $response, \Exception $exception = NULL) {
  if ($this
    ->getServicesCount()) {
    $tracedData = [];
    if ($this->container instanceof TraceableContainer) {
      $tracedData = $this->container
        ->getTracedData();
    }
    foreach (array_keys($this
      ->getServices()) as $id) {
      $this->data['services'][$id]['initialized'] = $this->container
        ->initialized($id) ? TRUE : FALSE;
      $this->data['services'][$id]['time'] = isset($tracedData[$id]) ? $tracedData[$id] : NULL;
    }
  }
}