protected function AppendOp::existingFileHasData in Drupal 8
Same name and namespace in other branches
- 9 composer/Plugin/Scaffold/Operations/AppendOp.php \Drupal\Composer\Plugin\Scaffold\Operations\AppendOp::existingFileHasData()
- 10 composer/Plugin/Scaffold/Operations/AppendOp.php \Drupal\Composer\Plugin\Scaffold\Operations\AppendOp::existingFileHasData()
Check to see if the append/prepend data has already been applied.
Parameters
string $contents: The contents of the target file.
\Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath $data_path: The path to the data to append or prepend
Return value
bool 'TRUE' if the append/prepend data already exists in contents.
1 call to AppendOp::existingFileHasData()
- AppendOp::scaffoldAtNewLocation in composer/
Plugin/ Scaffold/ Operations/ AppendOp.php - Determines what to do if operation is used without a previous operation.
File
- composer/
Plugin/ Scaffold/ Operations/ AppendOp.php, line 197
Class
- AppendOp
- Scaffold operation to add to the beginning and/or end of a scaffold file.
Namespace
Drupal\Composer\Plugin\Scaffold\OperationsCode
protected function existingFileHasData($contents, $data_path) {
if (empty($data_path)) {
return FALSE;
}
$data = file_get_contents($data_path
->fullPath());
return strpos($contents, $data) !== FALSE;
}