function VirtualFilesystem::getStat in X Autoload 7.4
Same name and namespace in other branches
- 7.5 tests/src/Filesystem/VirtualFilesystem.php \Drupal\xautoload\Tests\Filesystem\VirtualFilesystem::getStat()
Parameters
string $path:
bool $report:
Return value
array
File
- tests/
lib/ Filesystem/ VirtualFilesystem.php, line 163
Class
Namespace
Drupal\xautoload\Tests\FilesystemCode
function getStat($path, $report = TRUE) {
if ($report) {
$this->reportedOperations[] = $path . ' - stat';
}
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;
}
}