MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / phpIsDocumentRoot

Function phpIsDocumentRoot

src/extraction/languages/php.ts:132–138  ·  view source on GitHub ↗

* `$_SERVER['DOCUMENT_ROOT']`, in either quote and with any spacing inside the * brackets: the folder the web server serves, which only its configuration * names (#3298).

(node: SyntaxNode, source: string)

Source from the content-addressed store, hash-verified

130 * names (#3298).
131 */
132function phpIsDocumentRoot(node: SyntaxNode, source: string): boolean {
133 if (node.type !== 'subscript_expression' || node.namedChildCount !== 2) return false;
134 const variable = node.namedChild(0);
135 const key = node.namedChild(1);
136 return !!variable && !!key && variable.type === 'variable_name' &&
137 getNodeText(variable, source) === '$_SERVER' && phpLiteralText(key, source) === 'DOCUMENT_ROOT';
138}
139
140/**
141 * The path that string literals (and `DIRECTORY_SEPARATOR`, read as `/`)

Callers 1

phpDirectoryIncludePathFunction · 0.85

Calls 2

getNodeTextFunction · 0.90
phpLiteralTextFunction · 0.85

Tested by

no test coverage detected