public function RealisticDummyContentLiveEnvironment::implementFileGetContents in Realistic Dummy Content 3.x
Same name and namespace in other branches
- 8.2 api/src/includes/RealisticDummyContentLiveEnvironment.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentLiveEnvironment::implementFileGetContents()
- 7.2 api/src/includes/RealisticDummyContentLiveEnvironment.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentLiveEnvironment::implementFileGetContents()
Internal function used to get the contents of a file.
Wrapper around PHP's file_get_contents() (or a simulation thereof). This function will not return an exception. Please use RealisticDummyContentEnvironment::file_get_contents(), instead.
Parameters
string $filename: A valid filename, for example /drupal/root/sites/all/modules/your_module/ realistic_dummy_content/fields/node/blog/body/03.txt.
Return value
string Undefined in case the filename is invalid; otherwise returns the contents of the file.
Overrides RealisticDummyContentEnvironment::implementFileGetContents
File
- api/
src/ includes/ RealisticDummyContentLiveEnvironment.php, line 17
Class
- RealisticDummyContentLiveEnvironment
- The live environment.
Namespace
Drupal\realistic_dummy_content_api\includesCode
public function implementFileGetContents($filename) : string {
$return = file_get_contents($filename);
if ($return === FALSE) {
throw new \Exception('Cannot get contents of ' . $filename);
}
return $return;
}