You are here

public function FileOperations::fileReplace in AT Tools 8.3

Same name and namespace in other branches
  1. 8 at_theme_generator/src/File/FileOperations.php \Drupal\at_theme_generator\File\FileOperations::fileReplace()
  2. 8.2 at_theme_generator/src/File/FileOperations.php \Drupal\at_theme_generator\File\FileOperations::fileReplace()

Replace old file content with new content.

Parameters

string $data: Content to replace old file contents.

string $file_path: Path to file to be replaced.

File

at_theme_generator/src/File/FileOperations.php, line 70
Contains \Drupal\at_theme_generator\File\FileOperations

Class

FileOperations

Namespace

Drupal\at_theme_generator\File

Code

public function fileReplace($data, $file_path) {
  if (file_exists($file_path)) {
    file_unmanaged_save_data($data, $file_path, FILE_EXISTS_REPLACE);
  }
}