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

Method php_is_document_root

codegraph-kernel/src/php.rs:1019–1026  ·  view source on GitHub ↗

phpIsDocumentRoot (#3298): `$_SERVER['DOCUMENT_ROOT']`, in either quote and with any spacing inside the brackets — a `subscript_expression` of exactly the `variable_name` `$_SERVER` and a pure string literal `DOCUMENT_ROOT`.

(&self, node: Node<'t>)

Source from the content-addressed store, hash-verified

1017 /// `subscript_expression` of exactly the `variable_name` `$_SERVER` and
1018 /// a pure string literal `DOCUMENT_ROOT`.
1019 fn php_is_document_root(&self, node: Node<'t>) -> bool {
1020 node.kind() == "subscript_expression"
1021 && node.named_child_count() == 2
1022 && node
1023 .named_child(0)
1024 .is_some_and(|v| v.kind() == "variable_name" && self.text(v) == "$_SERVER")
1025 && node.named_child(1).and_then(|key| self.php_literal_text(key)) == Some("DOCUMENT_ROOT")
1026 }
1027
1028 /// phpAppendedPath (#3298): the path string literals (and
1029 /// `DIRECTORY_SEPARATOR`, read as `/`) append to a directory. It starts

Callers 1

Calls 2

php_literal_textMethod · 0.80
textMethod · 0.65

Tested by

no test coverage detected