菜谱项目

Node.php 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. * @deprecated
  29. */
  30. public function setLine($line);
  31. /**
  32. * Gets the doc comment of the node.
  33. *
  34. * The doc comment has to be the last comment associated with the node.
  35. *
  36. * @return null|Comment\Doc Doc comment object or null
  37. */
  38. public function getDocComment();
  39. /**
  40. * Sets the doc comment of the node.
  41. *
  42. * This will either replace an existing doc comment or add it to the comments array.
  43. *
  44. * @param Comment\Doc $docComment Doc comment to set
  45. */
  46. public function setDocComment(Comment\Doc $docComment);
  47. /**
  48. * Sets an attribute on a node.
  49. *
  50. * @param string $key
  51. * @param mixed $value
  52. */
  53. public function setAttribute($key, $value);
  54. /**
  55. * Returns whether an attribute exists.
  56. *
  57. * @param string $key
  58. *
  59. * @return bool
  60. */
  61. public function hasAttribute($key);
  62. /**
  63. * Returns the value of an attribute.
  64. *
  65. * @param string $key
  66. * @param mixed $default
  67. *
  68. * @return mixed
  69. */
  70. public function &getAttribute($key, $default = null);
  71. /**
  72. * Returns all attributes for the given node.
  73. *
  74. * @return array
  75. */
  76. public function getAttributes();
  77. }