You are here

public function RealisticDummyContentFileGroup::value in Realistic Dummy Content 8.2

Same name and namespace in other branches
  1. 7.2 api/src/includes/RealisticDummyContentFileGroup.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentFileGroup::value()
  2. 3.x api/src/includes/RealisticDummyContentFileGroup.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentFileGroup::value()

Returns the value of the radical file if one exists.

Return value

null|object 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/includes/RealisticDummyContentFileGroup.php, line 121

Class

RealisticDummyContentFileGroup
Represents files as groups.

Namespace

Drupal\realistic_dummy_content_api\includes

Code

public function value() {
  try {
    $file = $this
      ->getFile();
    if (isset($file->uri)) {
      return trim(RealisticDummyContentEnvironment::get()
        ->fileGetContents($file->uri));
    }
    else {
      return NULL;
    }
  } catch (Exception $e) {
    return NULL;
  }
}