You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

51 lines
1.1 KiB

  1. <?php
  2. namespace dokuwiki\Remote\OpenApiDoc;
  3. class DocBlockProperty extends DocBlock
  4. {
  5. /** @var Type */
  6. protected $type;
  7. /**
  8. * Parse the given docblock
  9. *
  10. * The docblock can be of a method, class or property.
  11. *
  12. * @param \ReflectionProperty $reflector
  13. */
  14. public function __construct(\ReflectionProperty $reflector)
  15. {
  16. parent::__construct($reflector);
  17. $this->refineVar();
  18. }
  19. /**
  20. * The Type of this property
  21. *
  22. * @return Type
  23. */
  24. public function getType()
  25. {
  26. return $this->type;
  27. }
  28. /**
  29. * Parse the var tag into its components
  30. *
  31. * @return void
  32. */
  33. protected function refineVar()
  34. {
  35. $refType = $this->reflector->getType();
  36. $this->type = new Type($refType ? $refType->getName() : 'string', $this->getContext());
  37. if (!isset($this->tags['var'])) return;
  38. [$type, $description] = array_map('trim', sexplode(' ', $this->tags['var'][0], 2, ''));
  39. $this->type = new Type($type, $this->getContext());
  40. $this->summary = $description;
  41. }
  42. }