Documentation
¶
Overview ¶
Package extractor provides utilities to extract traceable PHP expressions from code snippets
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExpressionExtractor ¶
type ExpressionExtractor struct {
// contains filtered or unexported fields
}
ExpressionExtractor extracts traceable PHP expressions from code
func New ¶
func New() *ExpressionExtractor
New creates a new ExpressionExtractor Uses centralized patterns from pkg/sources/common
func (*ExpressionExtractor) ExtractFromCode ¶
func (e *ExpressionExtractor) ExtractFromCode(lines []string) []ExtractedExpression
ExtractFromCode extracts all traceable expressions from PHP code lines
func (*ExpressionExtractor) ExtractFromDiffContext ¶
func (e *ExpressionExtractor) ExtractFromDiffContext(context []string) []ExtractedExpression
ExtractFromDiffContext extracts expressions from diff context (handles +/- prefixes)
func (*ExpressionExtractor) ExtractFromSnippet ¶
func (e *ExpressionExtractor) ExtractFromSnippet(snippet string) []ExtractedExpression
ExtractFromSnippet extracts ALL traceable expressions from a PHP code snippet This is the main entry point for snippet-only analysis
type ExtractedExpression ¶
type ExtractedExpression struct {
Expression string `json:"expression"`
Line int `json:"line"`
Type string `json:"type"` // "superglobal", "method_call", "property_access", "variable", "sql_embedded"
Context string `json:"context,omitempty"`
Key string `json:"key,omitempty"` // The extracted key (e.g., "aid" from $mybb->input['aid'])
VarName string `json:"var_name,omitempty"` // Variable name (e.g., "mybb")
PropertyName string `json:"property_name,omitempty"` // Property name (e.g., "input")
IsEscaped bool `json:"is_escaped,omitempty"` // Whether wrapped in escape_string()
EscapeWrapper string `json:"escape_wrapper,omitempty"` // The escape function used
}
ExtractedExpression represents a PHP expression extracted from code
Click to show internal directories.
Click to hide internal directories.