php-parser/node/stmt/interface.go
2018-01-09 15:51:32 +02:00

55 lines
963 B
Go

package stmt
import (
"github.com/z7zmey/php-parser/node"
)
type Interface struct {
PhpDocComment string
InterfaceName node.Node
Extends []node.Node
Stmts []node.Node
}
func NewInterface(InterfaceName node.Node, Extends []node.Node, Stmts []node.Node, PhpDocComment string) *Interface {
return &Interface{
PhpDocComment,
InterfaceName,
Extends,
Stmts,
}
}
func (n *Interface) Attributes() map[string]interface{} {
return map[string]interface{}{
"PhpDocComment": n.PhpDocComment,
}
}
func (n *Interface) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return
}
if n.InterfaceName != nil {
vv := v.GetChildrenVisitor("InterfaceName")
n.InterfaceName.Walk(vv)
}
if n.Extends != nil {
vv := v.GetChildrenVisitor("Extends")
for _, nn := range n.Extends {
nn.Walk(vv)
}
}
if n.Stmts != nil {
vv := v.GetChildrenVisitor("Stmts")
for _, nn := range n.Stmts {
nn.Walk(vv)
}
}
v.LeaveNode(n)
}