protected function FileProfilerStorage::createProfileFromData

1 call to FileProfilerStorage::createProfileFromData()
FileProfilerStorage::read in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php
Reads data associated with the given token.

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php, line 242

Class

FileProfilerStorage
Storage for profiler using files.

Namespace

Symfony\Component\HttpKernel\Profiler

Code

protected function createProfileFromData($token, $data, $parent = null) {
  $profile = new Profile($token);
  $profile
    ->setIp($data['ip']);
  $profile
    ->setMethod($data['method']);
  $profile
    ->setUrl($data['url']);
  $profile
    ->setTime($data['time']);
  $profile
    ->setCollectors($data['data']);
  if (!$parent && $data['parent']) {
    $parent = $this
      ->read($data['parent']);
  }
  if ($parent) {
    $profile
      ->setParent($parent);
  }
  foreach ($data['children'] as $token) {
    if (!$token || !file_exists($file = $this
      ->getFilename($token))) {
      continue;
    }
    $profile
      ->addChild($this
      ->createProfileFromData($token, unserialize(file_get_contents($file)), $profile));
  }
  return $profile;
}