MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / php_ns_to_dot

Function php_ns_to_dot

internal/cbm/lsp/php_lsp.c:93–109  ·  view source on GitHub ↗

PHP qualified names use "." in the graph (project.path.module.class[.method]). * Convert "App\\Models\\User" to "App.Models.User" so we can compose with * module_qn (which already uses ".") and look up registry entries. */

Source from the content-addressed store, hash-verified

91 * Convert "App\\Models\\User" to "App.Models.User" so we can compose with
92 * module_qn (which already uses ".") and look up registry entries. */
93static char *php_ns_to_dot(CBMArena *a, const char *ns) {
94 if (!ns)
95 return NULL;
96 size_t n = strlen(ns);
97 char *out = (char *)cbm_arena_alloc(a, n + 1);
98 if (!out)
99 return NULL;
100 for (size_t i = 0; i < n; i++) {
101 char c = ns[i];
102 out[i] = (c == '\\') ? '.' : c;
103 }
104 out[n] = '\0';
105 /* Trim leading dot from "\\Foo". */
106 if (out[0] == '.')
107 return out + 1;
108 return out;
109}
110
111/* Return the substring after the last '.' or '\\'. */
112static const char *php_short_name(const char *qn) {

Callers 5

php_resolve_class_nameFunction · 0.85
collect_use_clauseFunction · 0.85
set_namespace_from_declFunction · 0.85
parse_return_type_textFunction · 0.85
cbm_run_php_lspFunction · 0.85

Calls 1

cbm_arena_allocFunction · 0.50

Tested by

no test coverage detected