function ScaffoldFileInfo::hasChanged

Same name and namespace in other branches
  1. 9 composer/Plugin/Scaffold/ScaffoldFileInfo.php \Drupal\Composer\Plugin\Scaffold\ScaffoldFileInfo::hasChanged()
  2. 8.9.x composer/Plugin/Scaffold/ScaffoldFileInfo.php \Drupal\Composer\Plugin\Scaffold\ScaffoldFileInfo::hasChanged()
  3. 10 composer/Plugin/Scaffold/ScaffoldFileInfo.php \Drupal\Composer\Plugin\Scaffold\ScaffoldFileInfo::hasChanged()

Returns TRUE if the target does not exist or has changed.

Return value

bool

File

composer/Plugin/Scaffold/ScaffoldFileInfo.php, line 131

Class

ScaffoldFileInfo
Data object that keeps track of one scaffold file.

Namespace

Drupal\Composer\Plugin\Scaffold

Code

public final function hasChanged() {
    $path = $this->destination()
        ->fullPath();
    if (!file_exists($path)) {
        return TRUE;
    }
    return $this->op()
        ->contents() !== file_get_contents($path);
}

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