Node.php 1.4 KB

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