You are here

function coder_upgrade_upgrade_call_module_invoke_alter in Coder 7.2

Same name and namespace in other branches
  1. 7 coder_upgrade/conversions/call.inc \coder_upgrade_upgrade_call_module_invoke_alter()

Implements hook_upgrade_call_module_invoke_alter().

File

coder_upgrade/conversions/call.inc, line 1921
Provides conversion routines applied to function calls.

Code

function coder_upgrade_upgrade_call_module_invoke_alter(&$node, &$reader) {

  // DONE
  // Create helper objects.
  $editor = PGPEditor::getInstance();

  // Get the function call object.
  $item =& $node->data;

  // Process function call.
  $name =& $item->name;

  // http://drupal.org/node/224333#taxonomy_get_tree
  $depth = '$max_depth = NULL /* TODO Set this variable. */';
  $count = $item->parameters
    ->count();

  // Confirm this call relates to our topic.
  if ($count > 2) {
    $p0 = $item
      ->printParameter(0);
    $p1 = $item
      ->printParameter(1);
    if ($p0 != "'taxonomy'" || $p1 != "'get_tree'") {
      cdp("FAILED to relate");
      return;
    }
  }

  // Adjust parameters.
  if ($count > 5) {

    // Switch places.
    $p4 = $item
      ->getParameter(4);
    $p5 = $item
      ->getParameter(5);
    $item
      ->setParameter(4, $p5);
    $item
      ->setParameter(5, $p4);
  }
  elseif ($count > 4) {

    // Insert parameter due to change in parameter order.
    $editor
      ->insertParameter($item, 4, $depth);
    $count = $item->parameters
      ->count();
  }
  $defaults = array(
    array(
      'NULL',
      $depth,
    ),
    '-1',
  );
  $string = $editor
    ->removeDefaults($item, 4, $defaults);
}