original_string: private function getSafeName(string $name) : string
      {
          $name = preg_replace('/[^A-Za-z0-9-]/', '_', $name);
          if (strlen($name) > 64) {
              if (str_word_count($name) > 1 && preg_match_all('/\b(\w)/', $name, $m)) {
                  // Create an "acronym" from first letters
                  $short = implode('', $m[1]);
              } else {
                  $short = md5($name);
              }
              $short .= "_";
              $remaining = 64 - strlen($short);
              $nextSpace = strpos($name, " ", (strlen($name)-$remaining))
                  ? : strpos($name, "_", (strlen($name)-$remaining));
  
              $newName = $nextSpace === false
                  ? $short
                  : $short . substr($name, $nextSpace);
          } else {
              $newName = $name;
          }
  
          $newName = preg_replace('/[^A-Za-z0-9-]+/', '_', $newName);
          $newName = trim($newName, "_");
          return $newName;
      }
code: private function getSafeName(string $name) : string
      {
          $name = preg_replace('/[^A-Za-z0-9-]/', '_', $name);
          if (strlen($name) > 64) {
              if (str_word_count($name) > 1 && preg_match_all('/\b(\w)/', $name, $m)) {
                  // Create an "acronym" from first letters
                  $short = implode('', $m[1]);
              } else {
                  $short = md5($name);
              }
              $short .= "_";
              $remaining = 64 - strlen($short);
              $nextSpace = strpos($name, " ", (strlen($name)-$remaining))
                  ? : strpos($name, "_", (strlen($name)-$remaining));
  
              $newName = $nextSpace === false
                  ? $short
                  : $short . substr($name, $nextSpace);
          } else {
              $newName = $name;
          }
  
          $newName = preg_replace('/[^A-Za-z0-9-]+/', '_', $newName);
          $newName = trim($newName, "_");
          return $newName;
      }
code_tokens: private function getSafeName ( string $ name ) : string { $ name = preg_replace ( '/[^A-Za-z0-9-]/' , '_' , $ name ) ; if ( strlen ( $ name ) > 64 ) { if ( str_word_count ( $ name ) > 1 && preg_match_all ( '/\b(\w)/' , $ name , $ m ) ) { // Create an "acronym" from first letters $ short = implode ( '' , $ m [ 1 ] ) ; } else { $ short = md5 ( $ name ) ; } $ short .= "_" ; $ remaining = 64 - strlen ( $ short ) ; $ nextSpace = strpos ( $ name , " " , ( strlen ( $ name ) - $ remaining ) ) ? : strpos ( $ name , "_" , ( strlen ( $ name ) - $ remaining ) ) ; $ newName = $ nextSpace === false ? $ short : $ short . substr ( $ name , $ nextSpace ) ; } else { $ newName = $ name ; } $ newName = preg_replace ( '/[^A-Za-z0-9-]+/' , '_' , $ newName ) ; $ newName = trim ( $ newName , "_" ) ; return $ newName ; }
docstring: If necessary, change the name to a safe to store in database.
  @param string $name
  @return string
docstring_tokens: If necessary change the name to a safe to store in database .