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