You are here

function DummyFilesystem::getStat in X Autoload 7.3

Parameters

string $path:

Return value

array

File

tests/Drupal/xautoload/Tests/DummyFilesystem.php, line 83

Class

DummyFilesystem

Namespace

Drupal\xautoload\Tests

Code

function getStat($path) {
  if (!isset($this->knownPaths[$path])) {

    // File does not exist.
    return FALSE;
  }
  elseif (self::DIR === $this->knownPaths[$path]) {
    return stat(__DIR__);
  }
  else {

    // Create a tmp file with the contents and get its stats.
    $contents = $this
      ->getFileContents($path);
    $resource = tmpfile();
    fwrite($resource, $contents);
    $stat = fstat($resource);
    fclose($resource);
    return $stat;
  }
}