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

Function psr4_file_node

src/pipeline/pass_pkgmap.c:2097–2111  ·  view source on GitHub ↗

The File node at exactly `rel_path`, or NULL. Looked up through the name * index (File nodes are named by basename) and matched on the full path, so * a same-named file in another directory never qualifies. */

Source from the content-addressed store, hash-verified

2095 * index (File nodes are named by basename) and matched on the full path, so
2096 * a same-named file in another directory never qualifies. */
2097static const cbm_gbuf_node_t *psr4_file_node(const cbm_gbuf_t *gbuf, const char *rel_path) {
2098 const cbm_gbuf_node_t **hits = NULL;
2099 int hit_count = 0;
2100 if (cbm_gbuf_find_by_name(gbuf, path_leaf(rel_path), &hits, &hit_count) != 0 || !hits) {
2101 return NULL;
2102 }
2103 for (int i = 0; i < hit_count; i++) {
2104 const cbm_gbuf_node_t *n = hits[i];
2105 if (n && n->label && strcmp(n->label, "File") == 0 && n->file_path &&
2106 strcmp(n->file_path, rel_path) == 0) {
2107 return n;
2108 }
2109 }
2110 return NULL;
2111}
2112
2113/* Resolve a PHP class import `use A\B\C;` the way composer's PSR-4 autoloader
2114 * does: for every autoload.psr-4 prefix covering the name, longest first, the

Callers 1

resolve_php_psr4_classFunction · 0.85

Calls 2

cbm_gbuf_find_by_nameFunction · 0.85
path_leafFunction · 0.85

Tested by

no test coverage detected