You are here

public function RealisticDummyContentEnvironment::fileGetContents in Realistic Dummy Content 8.2

Same name and namespace in other branches
  1. 7.2 api/src/includes/RealisticDummyContentEnvironment.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentEnvironment::fileGetContents()
  2. 3.x 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

1 method overrides RealisticDummyContentEnvironment::fileGetContents()
RealisticDummyContentDummyEnvironment::fileGetContents in api/src/includes/RealisticDummyContentDummyEnvironment.php
Get the contents of a file.

File

api/src/includes/RealisticDummyContentEnvironment.php, line 65

Class

RealisticDummyContentEnvironment
The abstract base environment.

Namespace

Drupal\realistic_dummy_content_api\includes

Code

public function fileGetContents($filename) {
  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;
}