/** * Cleans the arguments array. * This method removes all whitespaces and the leading "$" sign from each argument * in the array. * * @static * @access private * @param $args(Array) The "dirty" array with arguments. */ function cleanArguments($args, $commentParams) { $result = array(); if (!is_array($args)) { return array(); } foreach ($args as $index => $arg) { $arg = strrstr(str_replace(array('$', '&$'), array('', '&'), $arg), '='); if (!isset($commentParams[$index])) { $result[] = trim($arg); } else { $start = trim($arg); $end = trim(str_replace('$', '', $commentParams[$index])); // Suppress Notice of 'Undefined offset' with @ @(list($word0, $word1, $tail) = preg_split("/[\\s]+/", $end, 3)); $word0 = strtolower($word0); $word1 = strtolower($word1); $wordBase0 = ereg_replace('^[&$]+', '', $word0); $wordBase1 = ereg_replace('^[&$]+', '', $word1); $startBase = strtolower(ereg_replace('^[&$]+', '', $start)); if ($wordBase0 == $startBase) { $type = str_replace(array('(', ')'), '', $word1); } elseif ($wordBase1 == $startBase) { $type = str_replace(array('(', ')'), '', $word0); } elseif (ereg('(^[&$]+)|(\\()([a-z0-9]+)(\\)$)', $word0, $regs)) { $tail = str_ireplace($word0, '', $end); $type = $regs[3]; } else { // default to string $type = 'string'; } $type = MethodTable::standardizeType($type); /* if($type == 'str') { $type = 'string'; } elseif($type == 'int' || $type == 'integer') { $type = 'int'; } elseif($type == 'bool' || $type == 'boolean') { $type = 'boolean'; } elseif($type == 'object' || $type == 'class') { // Note that this is not a valid XMLRPC type $type = 'object'; } elseif($type == 'float' || $type == 'dbl' || $type == 'double' || $type == 'flt') { $type = 'double'; } elseif($type == 'null') { // Note that this is not a valid XMLRPC type // The null type can have only one value - null. Why would // that be an argument to a function? Just in case: $type = 'null'; } elseif($type == 'mixed') { // Note that this is not a valid XMLRPC type $type = 'mixed'; } elseif($type == 'array' || $type == 'arr') { $type = 'array'; } elseif($type == 'assoc') { $type = 'struct'; } elseif($type == 'reference' || $type == 'ref') { // Note that this is not a valid XMLRPC type // As references cannot be serialized or exported, there is // no way this could be XML-RPCed. $type = 'reference'; } else { $type = 'string'; } */ $result[] = array('type' => $type, 'description' => $start . ' - ' . $tail); } } return $result; }