Version 1
[yaffs-website] / vendor / nikic / php-parser / lib / PhpParser / Node.php
1 <?php
2
3 namespace PhpParser;
4
5 interface Node
6 {
7     /**
8      * Gets the type of the node.
9      *
10      * @return string Type of the node
11      */
12     public function getType();
13
14     /**
15      * Gets the names of the sub nodes.
16      *
17      * @return array Names of sub nodes
18      */
19     public function getSubNodeNames();
20
21     /**
22      * Gets line the node started in.
23      *
24      * @return int Line
25      */
26     public function getLine();
27
28     /**
29      * Sets line the node started in.
30      *
31      * @param int $line Line
32      */
33     public function setLine($line);
34
35     /**
36      * Gets the doc comment of the node.
37      *
38      * The doc comment has to be the last comment associated with the node.
39      *
40      * @return null|Comment\Doc Doc comment object or null
41      */
42     public function getDocComment();
43
44     /**
45      * Sets the doc comment of the node.
46      *
47      * This will either replace an existing doc comment or add it to the comments array.
48      *
49      * @param Comment\Doc $docComment Doc comment to set
50      */
51     public function setDocComment(Comment\Doc $docComment);
52
53     /**
54      * Sets an attribute on a node.
55      *
56      * @param string $key
57      * @param mixed  $value
58      */
59     public function setAttribute($key, $value);
60
61     /**
62      * Returns whether an attribute exists.
63      *
64      * @param string $key
65      *
66      * @return bool
67      */
68     public function hasAttribute($key);
69
70     /**
71      * Returns the value of an attribute.
72      *
73      * @param string $key
74      * @param mixed  $default
75      *
76      * @return mixed
77      */
78     public function &getAttribute($key, $default = null);
79
80     /**
81      * Returns all attributes for the given node.
82      *
83      * @return array
84      */
85     public function getAttributes();
86 }