You are here

protected function ScaffoldFileCollection::checkListHasItemWithContent in Drupal 9

Same name and namespace in other branches
  1. 8 composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldFileCollection::checkListHasItemWithContent()

Scans through a list of scaffold files and determines if any has contents.

Parameters

Drupal\Composer\Plugin\Scaffold\ScaffoldFileInfo[] $scaffold_files: List of scaffold files, path: ScaffoldFileInfo

Return value

bool TRUE if at least one item in the list has content

1 call to ScaffoldFileCollection::checkListHasItemWithContent()
ScaffoldFileCollection::filterFiles in composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php
Removes any item that has a path matching any path in the provided list.

File

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

Class

ScaffoldFileCollection
Collection of scaffold files.

Namespace

Drupal\Composer\Plugin\Scaffold\Operations

Code

protected function checkListHasItemWithContent(array $scaffold_files) {
  foreach ($scaffold_files as $destination_rel_path => $scaffold_file) {
    $contents = $scaffold_file
      ->op()
      ->contents();
    if (!empty($contents)) {
      return TRUE;
    }
  }
  return FALSE;
}