MCPcopy Index your code
hub / github.com/php/frankenphp / SanitizePackageName

Function SanitizePackageName

internal/extgen/utils.go:34–43  ·  view source on GitHub ↗

EXPERIMENTAL

(name string)

Source from the content-addressed store, hash-verified

32
33// EXPERIMENTAL
34func SanitizePackageName(name string) string {
35 sanitized := strings.ReplaceAll(name, "-", "_")
36 sanitized = strings.ReplaceAll(sanitized, ".", "_")
37
38 if len(sanitized) > 0 && !unicode.IsLetter(rune(sanitized[0])) && sanitized[0] != '_' {
39 sanitized = "_" + sanitized
40 }
41
42 return sanitized
43}

Callers 7

cmdInitExtensionFunction · 0.92
TestSanitizePackageNameFunction · 0.85
buildContentMethod · 0.85
runExtensionInitMethod · 0.85
cleanupGeneratedFilesMethod · 0.85
TestMissingGenStubFunction · 0.85

Calls

no outgoing calls

Tested by 5

TestSanitizePackageNameFunction · 0.68
runExtensionInitMethod · 0.68
cleanupGeneratedFilesMethod · 0.68
TestMissingGenStubFunction · 0.68