/**
  * Save declaration information to the node_function
  *
  * @param functionName name of the function
  * @param arguments string containing arguments part of function
  *        declaration
  */
 public static function set_declaration(&$node_schema, &$node_function, $arguments)
 {
     if (strlen(trim($arguments)) == 0) {
         // no arguments to set for the function
     } else {
         $arguement_parts = explode(',', trim($arguments));
         $args = array();
         foreach ($arguement_parts as $part) {
             $chunks = preg_split("/[\\s]+/", $part, -1, PREG_SPLIT_NO_EMPTY);
             // per http://www.postgresql.org/docs/8.4/static/sql-createfunction.html
             // IN is default
             $direction = 'IN';
             $name = '';
             // if the first chunk is in or out, push it off as the direction
             if (strcasecmp($chunks[0], 'IN') == 0 || strcasecmp($chunks[0], 'OUT') == 0) {
                 $direction = strtoupper(array_shift($chunks));
             }
             // only 1 remaining chunk, and no match to known types, cry about it
             if (count($chunks) < 2 && preg_match(dbsteward::PATTERN_KNOWN_TYPES, implode(' ', $chunks)) == 0) {
                 throw new exception("unknown type encountered: " . implode(' ', $chunks));
             }
             // if the remainder is not a known type, push it off as the parameter name
             if (preg_match(dbsteward::PATTERN_KNOWN_TYPES, implode(' ', $chunks)) == 0) {
                 $name = array_shift($chunks);
             }
             // whatever is left is the type of the parameter
             $type = implode(' ', $chunks);
             // is reformed type in the known type list?
             if (preg_match(dbsteward::PATTERN_KNOWN_TYPES, $type) == 0) {
                 throw new exception("unknown type inferred: " . implode(' ', $chunks));
             }
             $function_parameter =& dbx::get_function_parameter($node_function, $name, true);
             dbx::set_attribute($function_parameter, 'direction', $direction);
             dbx::set_attribute($function_parameter, 'type', $type);
         }
     }
     return self::get_declaration($node_schema, $node_function);
 }