IPReflectionProperty.class.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. * An extended reflection/documentation class for class properties
  4. *
  5. * This class extends the reflectionProperty class by also parsing the
  6. * comment for javadoc compatible @tags and by providing help
  7. * functions to generate a WSDL file. The class might also
  8. * be used to generate a phpdoc on the fly
  9. *
  10. * @version 0.2
  11. * @author David Kingma
  12. * @extends reflectionProperty
  13. */
  14. class IPReflectionProperty extends reflectionProperty {
  15. /** @var string Classname to whom this property belongs */
  16. public $classname;
  17. /** @var string Type description of the property */
  18. public $type = "";
  19. /** @var boolean Determens if the property is a private property */
  20. public $isPrivate = false;
  21. /** @var string */
  22. public $description;
  23. /** @var boolean */
  24. public $optional = false;
  25. /** @var boolean */
  26. public $autoincrement = false;
  27. /** @var string */
  28. public $fullDescription = "";
  29. /** @var string */
  30. public $smallDescription = "";
  31. /** @var string */
  32. public $name = null;
  33. /** @var string */
  34. private $comment = null;
  35. /**
  36. * constructor. will initiate the commentParser
  37. *
  38. * @param string Class name
  39. * @param string Property name
  40. * @return void
  41. */
  42. public function __construct($class, $property){
  43. $this->classname = $class;
  44. parent::__construct($class, $property);
  45. $this->parseComment();
  46. }
  47. /**
  48. *
  49. * @param $annotationName String the annotation name
  50. * @param $annotationClass String the annotation class
  51. * @return void
  52. */
  53. public function getAnnotation($annotationName, $annotationClass = null){
  54. return IPPhpDoc::getAnnotation($this->comment, $annotationName, $annotationClass);
  55. }
  56. private function parseComment(){
  57. // No getDocComment available for properties in php 5.0.3 :(
  58. $this->comment = $this->getDocComment();
  59. new IPReflectionCommentParser($this->comment, $this);
  60. }
  61. }
  62. ?>