You are here

public function FileStorage::getRun in XHProf 8

Loads run.

Parameters

string $run_id: The run ID.

string $namespace: The run namespace.

Return value

\Drupal\xhprof\XHProfLib\Run The value object of the run.

Overrides StorageInterface::getRun

File

src/XHProfLib/Storage/FileStorage.php, line 52

Class

FileStorage
Provides file storage backend for xhprof runs.

Namespace

Drupal\xhprof\XHProfLib\Storage

Code

public function getRun($run_id, $namespace) {
  $file_name = $this
    ->fileName($run_id, $namespace);
  if (!file_exists($file_name)) {
    throw new \RuntimeException("Could not find file {$file_name}");
  }
  $serialized_contents = file_get_contents($file_name);
  $contents = @unserialize($serialized_contents);
  if ($contents === FALSE) {
    throw new \UnexpectedValueException("Unable to unserialize {$file_name}!");
  }
  return new Run($run_id, $namespace, $contents);
}