public static function normalizeName ($name) {
    if (is_object($name)) {
      $name = get_class($name);
    } else {
      $name = (string) $name;
    }

    // strip all non-normal characters from input
    $name = preg_replace('/[^\w\.\\\\]+/', '', $name);
    // convert namespace delimiters to periods
    $name = preg_replace('/[\\_]/', '.', $name);

    return $name;
  }