You are here

private function PrivateFileSchemeHandler::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 PrivateFileSchemeHandler::saveData()
PrivateFileSchemeHandler::getFile in src/Plugin/FileSchemeHandler/PrivateFileSchemeHandler.php
Makes file available to Drupal through the correct stream wrapper.

File

src/Plugin/FileSchemeHandler/PrivateFileSchemeHandler.php, line 123

Class

PrivateFileSchemeHandler
File scheme handler for private files.

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;
  }
}