MCPcopy Create free account
hub / github.com/z7zmey/php-parser / printStmtClass

Method printStmtClass

printer/printer.go:2250–2317  ·  view source on GitHub ↗
(n node.Node)

Source from the content-addressed store, hash-verified

2248}
2249
2250func (p *Printer) printStmtClass(n node.Node) {
2251 nn := n.(*stmt.Class)
2252 p.printFreeFloating(nn, freefloating.Start)
2253
2254 if nn.Modifiers != nil {
2255 for k, m := range nn.Modifiers {
2256 if k > 0 && m.GetFreeFloating().IsEmpty() {
2257 io.WriteString(p.w, " ")
2258 }
2259 p.Print(m)
2260 }
2261
2262 if nn.GetFreeFloating().IsEmpty() {
2263 io.WriteString(p.w, " ")
2264 }
2265 }
2266 p.printFreeFloating(nn, freefloating.ModifierList)
2267 io.WriteString(p.w, "class")
2268 p.printFreeFloating(nn, freefloating.Class)
2269
2270 if nn.ClassName != nil {
2271 if nn.ClassName.GetFreeFloating().IsEmpty() {
2272 io.WriteString(p.w, " ")
2273 }
2274 p.Print(nn.ClassName)
2275 }
2276
2277 if nn.ArgumentList != nil {
2278 p.printFreeFloating(nn.ArgumentList, freefloating.Start)
2279 io.WriteString(p.w, "(")
2280 p.joinPrint(",", nn.ArgumentList.Arguments)
2281 p.printFreeFloating(nn.ArgumentList, freefloating.ArgumentList)
2282 io.WriteString(p.w, ")")
2283 p.printFreeFloating(nn.ArgumentList, freefloating.End)
2284 }
2285
2286 if nn.Extends != nil {
2287 p.printFreeFloating(nn.Extends, freefloating.Start)
2288 if nn.Extends.GetFreeFloating().IsEmpty() {
2289 io.WriteString(p.w, " ")
2290 }
2291 io.WriteString(p.w, "extends")
2292 if nn.Extends.ClassName.GetFreeFloating().IsEmpty() {
2293 io.WriteString(p.w, " ")
2294 }
2295 p.Print(nn.Extends.ClassName)
2296 }
2297
2298 if nn.Implements != nil {
2299 p.printFreeFloating(nn.Implements, freefloating.Start)
2300 if nn.Implements.GetFreeFloating().IsEmpty() {
2301 io.WriteString(p.w, " ")
2302 }
2303 io.WriteString(p.w, "implements")
2304 if nn.Implements.InterfaceNames[0].GetFreeFloating().IsEmpty() {
2305 io.WriteString(p.w, " ")
2306 }
2307 p.joinPrint(",", nn.Implements.InterfaceNames)

Callers 1

printNodeMethod · 0.95

Calls 6

printFreeFloatingMethod · 0.95
PrintMethod · 0.95
joinPrintMethod · 0.95
printNodesMethod · 0.95
IsEmptyMethod · 0.80
GetFreeFloatingMethod · 0.65

Tested by

no test coverage detected