MCPcopy Create free account
hub / github.com/php/frankenphp / NamespacedName

Function NamespacedName

internal/extgen/utils.go:25–31  ·  view source on GitHub ↗

NamespacedName converts a namespace and name to a C-compatible format. E.g., namespace "Go\Extension" and name "MyClass" become "Go_Extension_MyClass". This symbol remains exported, so it's usable in templates.

(namespace, name string)

Source from the content-addressed store, hash-verified

23// E.g., namespace "Go\Extension" and name "MyClass" become "Go_Extension_MyClass".
24// This symbol remains exported, so it's usable in templates.
25func NamespacedName(namespace, name string) string {
26 if namespace == "" {
27 return name
28 }
29 namespacePart := strings.ReplaceAll(namespace, `\`, "_")
30 return namespacePart + "_" + name
31}
32
33// EXPERIMENTAL
34func SanitizePackageName(name string) string {

Callers 4

TestNamespacedNameFunction · 0.85
generateMethod · 0.85
TestNamespacedClassNameFunction · 0.85

Calls

no outgoing calls

Tested by 3

TestNamespacedNameFunction · 0.68
TestNamespacedClassNameFunction · 0.68