You are here

protected function FileProfilerStorage::createProfileFromData in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php \Symfony\Component\HttpKernel\Profiler\FileProfilerStorage::createProfileFromData()
1 call to FileProfilerStorage::createProfileFromData()
FileProfilerStorage::read in vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php
Reads data associated with the given token.

File

vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php, line 255

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;
}