You are here

function coder_upgrade_upgrade_call_url_alter in Coder 7.2

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

Implements hook_upgrade_call_url_alter().

File

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

Code

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

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

  // Get the function call object.
  $item =& $node->data;
  if ($item
    ->parameterCount() < 2) {

    // Nothing to do.
    return;
  }

  // Convert query string into an array
  $p1 = $item
    ->getParameter(1)
    ->getElement();
  if (!is_object($p1) || !$p1
    ->isType(T_ARRAY)) {

    // Add TODO comment.
    $item
      ->insertStatementBefore($editor
      ->commentToStatement('// TODO The second parameter to this function call should be an array.'));
    return;
  }
  if ($query =& $p1
    ->findValue('query')) {
    if ($query
      ->isType(T_CONSTANT_ENCAPSED_STRING)) {
      $query = coder_upgrade_query_to_array($query
        ->first()->data['value']);
    }
  }
}