public function RealisticDummyContentEnvironment::fileGetContents in Realistic Dummy Content 3.x
Same name and namespace in other branches
- 8.2 api/src/includes/RealisticDummyContentEnvironment.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentEnvironment::fileGetContents()
- 7.2 api/src/includes/RealisticDummyContentEnvironment.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentEnvironment::fileGetContents()
Get the contents of a file.
Parameters
string $filename: A valid filename, for example /drupal/root/sites/all/modules/ your_module/realistic_dummy_content/fields/node/blog/body/03.txt.
Throws
\Exception
File
- api/
src/ includes/ RealisticDummyContentEnvironment.php, line 65
Class
- RealisticDummyContentEnvironment
- The abstract base environment.
Namespace
Drupal\realistic_dummy_content_api\includesCode
public function fileGetContents($filename) : string {
if (!$filename) {
throw new RealisticDummyContentException('Please use valid filename');
}
if (strpos($filename, '/') === FALSE) {
throw new RealisticDummyContentException('Please use an absolute filename including its path, which must always contain at least one slash. You are using ' . $filename);
}
$return = $this
->implementFileGetContents($filename);
return $return;
}