You are here

public function ServicesDataCollector::getData in Devel 8.2

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

Return value

array

Overrides DrupalDataCollectorInterface::getData

File

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

Class

ServicesDataCollector
Class ServicesDataCollector

Namespace

Drupal\webprofiler\DataCollector

Code

public function getData() {
  $data = $this->data;
  $http_middleware = array_filter($data['services'], function ($service) {
    return isset($service['value']['tags']['http_middleware']);
  });
  foreach ($http_middleware as &$service) {
    $service['value']['handle_method'] = $this
      ->getMethodData($service['value']['class'], 'handle');
  }
  uasort($http_middleware, function ($a, $b) {
    $va = $a['value']['tags']['http_middleware'][0]['priority'];
    $vb = $b['value']['tags']['http_middleware'][0]['priority'];
    if ($va == $vb) {
      return 0;
    }
    return $va > $vb ? -1 : 1;
  });
  $data['http_middleware'] = $http_middleware;
  return $data;
}