Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. OperationFactory.php

function OperationFactory::hasContent

Checks to see if the specified scaffold file exists and has content.

Parameters

\Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath|null $file: (optional) Scaffold file to check.

Return value

bool True if the file exists and has content.

1 call to OperationFactory::hasContent()
OperationFactory::createAppendOp in composer/Plugin/Scaffold/Operations/OperationFactory.php
Creates an 'append' (or 'prepend') scaffold op.

File

composer/Plugin/Scaffold/Operations/OperationFactory.php, line 131

Class

OperationFactory
Create Scaffold operation objects based on provided metadata.

Namespace

Drupal\Composer\Plugin\Scaffold\Operations

Code

protected function hasContent(?ScaffoldFilePath $file = NULL) {
    if (!$file) {
        return FALSE;
    }
    $path = $file->fullPath();
    return is_file($path) && filesize($path) > 0;
}
RSS feed
Powered by Drupal