function coder_upgrade_callback_return_case5 in Coder 7.2
Same name and namespace in other branches
- 7 coder_upgrade/conversions/tool.inc \coder_upgrade_callback_return_case5()
1 call to coder_upgrade_callback_return_case5()
- coder_upgrade_convert_return_loop_OLD in coder_upgrade/
conversions/ tool.inc
File
- coder_upgrade/
conversions/ tool.inc, line 709 - Provides tools to assist with conversion routines.
Code
function coder_upgrade_callback_return_case5($assignment, $hook, $callback = '') {
// NOT DONE
cdp("inside " . __FUNCTION__);
/*
* TODO Convert the assignment into an array expression. Then pass off the
* array to coder_upgrade_callback_return_case3.
*
* Loop on assignment to remove all nodes up to and including the assignment
* operator. Grab the second index from the first node. Then toString() and
* build an array with the second index as the key.
*/
$assign_variable2 = $assignment->values
->getElement()
->getElement()
->stripComments();
$key2 = $assign_variable2
->getType('index', 2);
if ($assignment->values
->getElement()
->get(1)->type != 'assign') {
clp("ERROR: second element of assignment is not the assignment operator");
return;
}
$editor = PGPEditor::getInstance();
// Remove the assignee and the assignment operator.
$assignment = $assignment->values
->getElement();
$assignment
->deleteElement();
$assignment
->deleteElement();
$temp = $assignment;
//->values->getElement()->getElement(2); // ->stripComments();
$key = trim($key2
->toString(), "'\"");
$array2 = $editor
->expressionToStatement("array('{$key}' => {$temp->toString()})")
->getElement();
coder_upgrade_callback_return_case3($array2, $hook, $callback);
}