You are here

class MigrateTools in Migrate Tools 8.5

Same name and namespace in other branches
  1. 8.4 src/MigrateTools.php \Drupal\migrate_tools\MigrateTools

Utility functionality for use in migrate_tools.

Hierarchy

Expanded class hierarchy of MigrateTools

3 files declare their use of MigrateTools
DrushTest.php in tests/src/Kernel/DrushTest.php
MigrateToolsCommands.php in src/Commands/MigrateToolsCommands.php
MigrateToolsTest.php in tests/src/Unit/MigrateToolsTest.php

File

src/MigrateTools.php, line 8

Namespace

Drupal\migrate_tools
View source
class MigrateTools {

  /**
   * Default ID list delimiter.
   */
  const DEFAULT_ID_LIST_DELIMITER = ':';

  /**
   * Build the list of specific source IDs to import.
   *
   * @param array $options
   *   The migration executable options.
   *
   * @return array
   *   The ID list.
   */
  public static function buildIdList(array $options) {
    $options += [
      'idlist' => NULL,
      'idlist-delimiter' => self::DEFAULT_ID_LIST_DELIMITER,
    ];
    $id_list = [];
    if ($options['idlist']) {
      $id_list = explode(',', $options['idlist']);
      array_walk($id_list, function (&$value) use ($options) {
        $value = str_getcsv($value, $options['idlist-delimiter']);
      });
    }
    return $id_list;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MigrateTools::buildIdList public static function Build the list of specific source IDs to import.
MigrateTools::DEFAULT_ID_LIST_DELIMITER constant Default ID list delimiter.