You are here

function coder_upgrade_upgrade_call_book_toc_alter in Coder 7

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

Implements hook_upgrade_call_book_toc_alter().

File

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

Code

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

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

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

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

  // Adjust parameters.
  $count = $item->parameters
    ->count();
  if ($count > 2) {

    // Switch places.
    $p1 = $item
      ->getParameter(1);
    $p2 = $item
      ->getParameter(2);
    $item
      ->setParameter(1, $p2);
    $item
      ->setParameter(2, $p1);
  }

  // Remove default parameter.
  if ($count == 3) {
    $value = $item
      ->printParameter(2);
    cdp("value = {$value}");
    if ($value == 'array()') {
      $item
        ->deleteParameter(2);
    }
  }
}