Documentation
¶
Index ¶
- type ASTPropertyExtractor
- func (e *ASTPropertyExtractor) ExtractMapFromClass(classNode *ast.StmtClass, propertyName string) map[string]string
- func (e *ASTPropertyExtractor) ExtractMethodCalls(methodNode *ast.StmtClassMethod) []MethodCall
- func (e *ASTPropertyExtractor) ExtractStringArrayFromClass(classNode *ast.StmtClass, propertyName string) []string
- func (e *ASTPropertyExtractor) ExtractStringPropertyFromClass(classNode *ast.StmtClass, propertyName string) string
- type Adapter
- type Analyzer
- type Controller
- type ControllerAction
- type ControllerAnalyzer
- type EloquentAnalyzer
- type EloquentAttribute
- type EloquentModel
- type EloquentRelation
- type EloquentScope
- type LaravelInfo
- type MethodCall
- type Middleware
- type Migration
- type Route
- type RouteAnalyzer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ASTPropertyExtractor ¶
type ASTPropertyExtractor struct{}
ASTPropertyExtractor helps extract property values from PHP AST nodes
func NewASTPropertyExtractor ¶
func NewASTPropertyExtractor() *ASTPropertyExtractor
NewASTPropertyExtractor creates a new AST property extractor
func (*ASTPropertyExtractor) ExtractMapFromClass ¶
func (e *ASTPropertyExtractor) ExtractMapFromClass(classNode *ast.StmtClass, propertyName string) map[string]string
ExtractMapFromClass extracts an associative array (map) from a class property Example: protected $casts = ['is_admin' => 'boolean', 'age' => 'integer'];
func (*ASTPropertyExtractor) ExtractMethodCalls ¶
func (e *ASTPropertyExtractor) ExtractMethodCalls(methodNode *ast.StmtClassMethod) []MethodCall
ExtractMethodCalls extracts method calls from a method body Example: return $this->hasMany(Post::class);
func (*ASTPropertyExtractor) ExtractStringArrayFromClass ¶
func (e *ASTPropertyExtractor) ExtractStringArrayFromClass(classNode *ast.StmtClass, propertyName string) []string
ExtractStringArrayFromClass extracts a protected/private string array property from a class node Example: protected $fillable = ['name', 'email'];
func (*ASTPropertyExtractor) ExtractStringPropertyFromClass ¶
func (e *ASTPropertyExtractor) ExtractStringPropertyFromClass(classNode *ast.StmtClass, propertyName string) string
ExtractStringPropertyFromClass extracts a simple string property value Example: protected $table = 'users';
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter implements codetypes.PathAnalyzer for Laravel projects It wraps the standard PHP analyzer and adds Laravel-specific analysis
type Analyzer ¶
type Analyzer struct {
// contains filtered or unexported fields
}
Analyzer is the main Laravel framework analyzer that coordinates all Laravel-specific analyzers
func NewAnalyzer ¶
func NewAnalyzer(packageInfo *php.PackageInfo) *Analyzer
NewAnalyzer creates a new Laravel framework analyzer
func (*Analyzer) Analyze ¶
func (a *Analyzer) Analyze() *LaravelInfo
Analyze performs complete Laravel framework analysis on the package
func (*Analyzer) AnalyzeWithRoutes ¶
func (a *Analyzer) AnalyzeWithRoutes(routePaths []string) *LaravelInfo
AnalyzeWithRoutes performs analysis including route files
type Controller ¶
type Controller struct {
ClassName string `json:"class_name"`
Namespace string `json:"namespace"`
FullName string `json:"full_name"`
Description string `json:"description"`
BaseController string `json:"base_controller,omitempty"` // Extends Controller/ApiController
IsResource bool `json:"is_resource"` // Resource controller
IsApi bool `json:"is_api"` // API controller
Actions []ControllerAction `json:"actions"`
Middleware []string `json:"middleware,omitempty"` // Middleware applied
FilePath string `json:"file_path"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
}
Controller represents a Laravel controller
type ControllerAction ¶
type ControllerAction struct {
Name string `json:"name"` // Method name
Description string `json:"description"` // PHPDoc description
HttpMethods []string `json:"http_methods,omitempty"`
Route string `json:"route,omitempty"` // Associated route pattern
Parameters []string `json:"parameters,omitempty"` // Method parameters
Returns string `json:"returns,omitempty"` // Return type
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
}
ControllerAction represents a controller method/action
type ControllerAnalyzer ¶
type ControllerAnalyzer struct {
// contains filtered or unexported fields
}
ControllerAnalyzer detects and analyzes Laravel controllers
func NewControllerAnalyzer ¶
func NewControllerAnalyzer(pkgInfo *php.PackageInfo) *ControllerAnalyzer
NewControllerAnalyzer creates a new controller analyzer
func (*ControllerAnalyzer) AnalyzeControllers ¶
func (a *ControllerAnalyzer) AnalyzeControllers() []Controller
AnalyzeControllers detects controllers and extracts actions
type EloquentAnalyzer ¶
type EloquentAnalyzer struct {
// contains filtered or unexported fields
}
EloquentAnalyzer extracts Eloquent model information from PHP package info
func NewEloquentAnalyzer ¶
func NewEloquentAnalyzer(packageInfo *php.PackageInfo) *EloquentAnalyzer
NewEloquentAnalyzer creates a new Eloquent analyzer
func (*EloquentAnalyzer) AnalyzeModels ¶
func (a *EloquentAnalyzer) AnalyzeModels() []EloquentModel
AnalyzeModels detects Eloquent models in the package and extracts Laravel-specific features
type EloquentAttribute ¶
type EloquentAttribute struct {
Name string `json:"name"` // Attribute name
MethodName string `json:"method_name"` // Method name (e.g., "getFullNameAttribute")
Type string `json:"type"` // "accessor" or "mutator"
Description string `json:"description,omitempty"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
}
EloquentAttribute represents an accessor or mutator
type EloquentModel ¶
type EloquentModel struct {
ClassName string `json:"class_name"`
Namespace string `json:"namespace"`
FullName string `json:"full_name"`
Description string `json:"description"`
Table string `json:"table,omitempty"` // $table property
Fillable []string `json:"fillable,omitempty"` // $fillable array
Guarded []string `json:"guarded,omitempty"` // $guarded array
Casts map[string]string `json:"casts,omitempty"` // $casts array
Dates []string `json:"dates,omitempty"` // $dates array (legacy)
Hidden []string `json:"hidden,omitempty"` // $hidden array
Visible []string `json:"visible,omitempty"` // $visible array
Appends []string `json:"appends,omitempty"` // $appends array
Relations []EloquentRelation `json:"relations,omitempty"` // Detected relations
Scopes []EloquentScope `json:"scopes,omitempty"` // Query scopes
Attributes []EloquentAttribute `json:"attributes,omitempty"` // Accessors/Mutators
PrimaryKey string `json:"primary_key,omitempty"` // $primaryKey
Timestamps bool `json:"timestamps"` // $timestamps (default true)
SoftDeletes bool `json:"soft_deletes"` // Uses SoftDeletes trait
FilePath string `json:"file_path"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
}
EloquentModel represents a Laravel Eloquent model with ORM features
type EloquentRelation ¶
type EloquentRelation struct {
Name string `json:"name"` // Method name (e.g., "posts")
Type string `json:"type"` // hasOne, hasMany, belongsTo, belongsToMany, etc.
RelatedModel string `json:"related_model"` // Related model class (e.g., "App\\Models\\Post")
ForeignKey string `json:"foreign_key,omitempty"`
LocalKey string `json:"local_key,omitempty"`
Description string `json:"description,omitempty"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
}
EloquentRelation represents a relationship method in an Eloquent model
type EloquentScope ¶
type EloquentScope struct {
Name string `json:"name"` // Scope name without "scope" prefix
MethodName string `json:"method_name"` // Full method name (e.g., "scopeActive")
Description string `json:"description,omitempty"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
}
EloquentScope represents a query scope (scopeMethodName)
type LaravelInfo ¶
type LaravelInfo struct {
Models []EloquentModel `json:"models"`
Controllers []Controller `json:"controllers"`
Routes []Route `json:"routes"`
Migrations []Migration `json:"migrations,omitempty"`
Middleware []Middleware `json:"middleware,omitempty"`
}
LaravelInfo contains Laravel-specific framework information extracted from a project
type MethodCall ¶
type MethodCall struct {
Object string // Variable name ($this, $variable)
Method string // Method name (hasMany, belongsTo)
Args []string // Arguments
}
MethodCall represents a method call found in code
type Middleware ¶
type Middleware struct {
ClassName string `json:"class_name"`
Namespace string `json:"namespace"`
FullName string `json:"full_name"`
Description string `json:"description"`
Alias string `json:"alias,omitempty"` // Middleware alias in kernel
FilePath string `json:"file_path"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
}
Middleware represents a middleware class
type Migration ¶
type Migration struct {
ClassName string `json:"class_name"`
Description string `json:"description"`
Table string `json:"table,omitempty"` // Table being modified
Operations []string `json:"operations,omitempty"` // create, update, drop, etc.
FilePath string `json:"file_path"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
}
Migration represents a database migration file
type Route ¶
type Route struct {
Method string `json:"method"` // GET, POST, PUT, DELETE, etc.
URI string `json:"uri"` // Route pattern (e.g., "/users/{id}")
Name string `json:"name,omitempty"`
Controller string `json:"controller,omitempty"` // Controller@action or FQCN
Action string `json:"action,omitempty"` // Action method name
Middleware []string `json:"middleware,omitempty"`
Description string `json:"description,omitempty"`
FilePath string `json:"file_path"` // routes/web.php or routes/api.php
Line int `json:"line"`
}
Route represents a Laravel route definition
type RouteAnalyzer ¶
type RouteAnalyzer struct {
// contains filtered or unexported fields
}
RouteAnalyzer parses Laravel route files
func NewRouteAnalyzer ¶
func NewRouteAnalyzer() *RouteAnalyzer
NewRouteAnalyzer creates a new route analyzer