You are here

public function BinaryData::getString in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/TypedData/Plugin/DataType/BinaryData.php \Drupal\Core\TypedData\Plugin\DataType\BinaryData::getString()

Returns a string representation of the data.

Return value

string The string representation of the data.

Overrides TypedData::getString

File

core/lib/Drupal/Core/TypedData/Plugin/DataType/BinaryData.php, line 76

Class

BinaryData
The binary data type.

Namespace

Drupal\Core\TypedData\Plugin\DataType

Code

public function getString() {

  // Return the file content.
  $contents = '';
  while (!feof($this
    ->getValue())) {
    $contents .= fread($this->handle, 8192);
  }
  return $contents;
}