You are here

public function DrupalDataCollectorTrait::getMethodData in Devel 8

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

Parameters

$class:

$method:

Return value

array

File

webprofiler/src/DataCollector/DrupalDataCollectorTrait.php, line 58

Class

DrupalDataCollectorTrait
Class DrupalDataCollectorTrait

Namespace

Drupal\webprofiler\DataCollector

Code

public function getMethodData($class, $method) {
  $class = is_object($class) ? get_class($class) : $class;
  $data = [];
  try {
    $reflectedMethod = new \ReflectionMethod($class, $method);
    $data = [
      'class' => $class,
      'method' => $method,
      'file' => $reflectedMethod
        ->getFilename(),
      'line' => $reflectedMethod
        ->getStartLine(),
    ];
  } catch (\ReflectionException $re) {

    // TODO: handle the exception.
  } finally {
    return $data;
  }
}