Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / migrate_tools / src / Drush9LogMigrateMessage.php
diff --git a/web/modules/contrib/migrate_tools/src/Drush9LogMigrateMessage.php b/web/modules/contrib/migrate_tools/src/Drush9LogMigrateMessage.php
new file mode 100644 (file)
index 0000000..0217a58
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+
+namespace Drupal\migrate_tools;
+
+use Drupal\migrate\MigrateMessageInterface;
+use Psr\Log\LoggerAwareInterface;
+use Psr\Log\LoggerAwareTrait;
+use Psr\Log\LoggerInterface;
+
+/**
+ * Print message in drush from migrate message. Drush 9 version.
+ *
+ * @package Drupal\migrate_tools
+ */
+class Drush9LogMigrateMessage implements MigrateMessageInterface, LoggerAwareInterface {
+
+  use LoggerAwareTrait;
+
+  /**
+   * The map between migrate status and drush log levels.
+   *
+   * @var array
+   */
+  protected $map = [
+    'status' => 'notice',
+  ];
+
+  /**
+   * DrushLogMigrateMessage constructor.
+   */
+  public function __construct(LoggerInterface $logger) {
+    $this->setLogger($logger);
+  }
+
+  /**
+   * Output a message from the migration.
+   *
+   * @param string $message
+   *   The message to display.
+   * @param string $type
+   *   The type of message to display.
+   */
+  public function display($message, $type = 'status') {
+    $type = isset($this->map[$type]) ? $this->map[$type] : $type;
+    $this->logger->log($type, $message);
+  }
+
+}