function ScaffoldFileCollection::checkListHasItemWithContent

Same name in other branches
  1. 9 composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldFileCollection::checkListHasItemWithContent()
  2. 10 composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldFileCollection::checkListHasItemWithContent()
  3. 11.x 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;
}

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