You are here

private function FileStorage::scanXHProfDir in XHProf 8

Parameters

string $dir:

string $namespace:

Return value

array

1 call to FileStorage::scanXHProfDir()
FileStorage::getRuns in src/XHProfLib/Storage/FileStorage.php
Returns a list of stored runs.

File

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

Class

FileStorage
Provides file storage backend for xhprof runs.

Namespace

Drupal\xhprof\XHProfLib\Storage

Code

private function scanXHProfDir($dir, $namespace = NULL) {
  $runs = [];
  if (is_dir($dir)) {
    foreach (glob("{$this->dir}/*.{$this->suffix}") as $file) {
      preg_match("/(?:(?<run>\\w+)\\.)(?:(?<namespace>[^.]+)\\.)(?<ext>[\\w.]+)/", basename($file), $matches);
      $runs[] = [
        'run_id' => $matches['run'],
        'namespace' => $matches['namespace'],
        'basename' => htmlentities(basename($file)),
        'date' => date("Y-m-d H:i:s", filemtime($file)),
        'size' => filesize($file),
      ];
    }
  }
  return array_reverse($runs);
}