function ScaffoldFileCollection::filterFiles

Same name in other branches
  1. 9 composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldFileCollection::filterFiles()
  2. 8.9.x composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldFileCollection::filterFiles()
  3. 10 composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldFileCollection::filterFiles()

Removes any item that has a path matching any path in the provided list.

Matching is done via destination path.

Parameters

string[] $files_to_filter: List of destination paths

File

composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php, line 82

Class

ScaffoldFileCollection
Collection of scaffold files.

Namespace

Drupal\Composer\Plugin\Scaffold\Operations

Code

public function filterFiles(array $files_to_filter) {
    foreach ($this->scaffoldFilesByProject as $project_name => $scaffold_files) {
        foreach ($scaffold_files as $destination_rel_path => $scaffold_file) {
            if (in_array($destination_rel_path, $files_to_filter, TRUE)) {
                unset($scaffold_files[$destination_rel_path]);
            }
        }
        $this->scaffoldFilesByProject[$project_name] = $scaffold_files;
        if (!$this->checkListHasItemWithContent($scaffold_files)) {
            unset($this->scaffoldFilesByProject[$project_name]);
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.