You are here

function FileGroup::Value in Realistic Dummy Content 8

Returns the value of the radical file if one exists.

Return value

NULL if a radical file does not exist, if it does not have contents, or if an error occurred. Otherwise returns the contents of the file.

File

api/src/environments/FileGroup.php, line 129
Define autoload class.

Class

FileGroup
Represents files as groups.

Namespace

Drupal\realistic_dummy_content_api\environments

Code

function Value() {
  try {
    $file = $this
      ->GetFile();
    if (isset($file->uri)) {
      return trim(Environment::Get()
        ->file_get_contents($file->uri));
    }
    else {
      return NULL;
    }
  } catch (\Exception $e) {
    return NULL;
  }
}