You are here

protected function AcquiaContentHubPublisherAuditEntityCommands::auditModuleDependencies in Acquia Content Hub 8.2

Audits module dependencies.

Parameters

\Acquia\ContentHubClient\CDF\CDFObjectInterface $cdf: The locally generated CDF.

\Acquia\ContentHubClient\CDF\CDFObjectInterface $remote_cdf: The remote CDF.

1 call to AcquiaContentHubPublisherAuditEntityCommands::auditModuleDependencies()
AcquiaContentHubPublisherAuditEntityCommands::auditEntity in modules/acquia_contenthub_publisher/src/Commands/AcquiaContentHubPublisherAuditEntityCommands.php
Audits an entity for differences with existing CDF in Acquia Content Hub.

File

modules/acquia_contenthub_publisher/src/Commands/AcquiaContentHubPublisherAuditEntityCommands.php, line 399

Class

AcquiaContentHubPublisherAuditEntityCommands
Drush commands for Acquia Content Hub Publishers Audit Entity.

Namespace

Drupal\acquia_contenthub_publisher\Commands

Code

protected function auditModuleDependencies(CDFObjectInterface $cdf, CDFObjectInterface $remote_cdf) {
  $modules = $cdf
    ->getModuleDependencies();
  $remote_modules = $remote_cdf
    ->getModuleDependencies();
  $m = 1;
  $modules_check = TRUE;
  $content = [];
  foreach ($modules as $module) {
    $remote_module = NULL;
    if (in_array($module, $remote_modules)) {
      $remote_module = $module;
      $remote_modules = array_diff($remote_modules, [
        $remote_module,
      ]);
    }
    $content[] = [
      $m++,
      $module,
      $remote_module ?? '',
      $remote_module ? '<info>OK</info>' : '<error>Fail</error>',
    ];
    $modules_check = $modules_check && (bool) $remote_module;
  }
  foreach ($remote_modules as $remote_module) {
    $content[] = [
      $m++,
      '',
      $remote_module,
      '<error>Fail</error>',
    ];
    $modules_check = FALSE;
  }
  if (!$modules_check) {
    $this
      ->setResults(self::NEEDS_REEXPORT);
  }
  $message = sprintf('CDF Module Dependencies, Local vs Remote Analysis:');
  $headers = [
    '#',
    'Local',
    'Remote',
    'Match',
  ];
  $this
    ->printTableOutput($message, $headers, $content);
}