Node.php 1.4 KB

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