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

Breadcrumb

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

function Comparer::doCompare

File

vendor/composer/composer/src/Composer/Package/Comparer/Comparer.php, line 81

Class

Comparer
class Comparer

Namespace

Composer\Package\Comparer

Code

public function doCompare() : void {
    $source = [];
    $destination = [];
    $this->changed = [];
    $currentDirectory = Platform::getCwd();
    chdir($this->source);
    $source = $this->doTree('.', $source);
    if (!is_array($source)) {
        return;
    }
    chdir($currentDirectory);
    chdir($this->update);
    $destination = $this->doTree('.', $destination);
    if (!is_array($destination)) {
        exit;
    }
    chdir($currentDirectory);
    foreach ($source as $dir => $value) {
        foreach ($value as $file => $hash) {
            if (isset($destination[$dir][$file])) {
                if ($hash !== $destination[$dir][$file]) {
                    $this->changed['changed'][] = $dir . '/' . $file;
                }
            }
            else {
                $this->changed['removed'][] = $dir . '/' . $file;
            }
        }
    }
    foreach ($destination as $dir => $value) {
        foreach ($value as $file => $hash) {
            if (!isset($source[$dir][$file])) {
                $this->changed['added'][] = $dir . '/' . $file;
            }
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal