public static function RealisticDummyContentEnvironment::getFileContents in Realistic Dummy Content 7.2
Same name and namespace in other branches
- 8.2 api/src/includes/RealisticDummyContentEnvironment.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentEnvironment::getFileContents()
- 3.x api/src/includes/RealisticDummyContentEnvironment.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentEnvironment::getFileContents()
Returns the trimmed contents of a Drpual file object, or NULL if empty.
Parameters
object $file: A drupal file object.
Return value
null|string NULL if no contents in file, or if an error occurred; otherwise a string with the trimmed contents of the file.
File
- api/
src/ includes/ RealisticDummyContentEnvironment.php, line 441
Class
- RealisticDummyContentEnvironment
- The abstract base environment.
Namespace
Drupal\realistic_dummy_content_api\includesCode
public static function getFileContents($file) {
try {
if (!is_object($file)) {
throw new RealisticDummyContentException('Please use a file object');
}
return trim(self::get()
->fileGetContents($file->uri));
} catch (Exception $e) {
return NULL;
}
}