You are here

private function PublicFileSchemeHandler::saveData in Acquia Content Hub 8.2

Save the data to file system.

Parameters

string $data: Data to save.

string $destination: Destination of data.

int $replace: Replacement option.

Return value

bool|string String saved or bool if failed.

1 call to PublicFileSchemeHandler::saveData()
PublicFileSchemeHandler::getFile in src/Plugin/FileSchemeHandler/PublicFileSchemeHandler.php
Makes file available to Drupal through the correct stream wrapper.

File

src/Plugin/FileSchemeHandler/PublicFileSchemeHandler.php, line 125

Class

PublicFileSchemeHandler
The handler for files with a public file scheme.

Namespace

Drupal\acquia_contenthub\Plugin\FileSchemeHandler

Code

private function saveData(string $data, string $destination, int $replace) {
  try {
    return $this->fileSystem
      ->saveData($data, $destination, $replace);
  } catch (FileWriteException $e) {
    \Drupal::messenger()
      ->addError(t('The file could not be created.'));
    return FALSE;
  } catch (FileException $e) {
    return FALSE;
  }
}