EventDoc.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\apidoc\models;
  8. use phpDocumentor\Reflection\DocBlock\Tag\ReturnTag;
  9. /**
  10. * Represents API documentation information for an `event`.
  11. *
  12. * @author Carsten Brandt <mail@cebe.cc>
  13. * @since 2.0
  14. */
  15. class EventDoc extends ConstDoc
  16. {
  17. public $type;
  18. public $types;
  19. /**
  20. * @param \phpDocumentor\Reflection\ClassReflector\ConstantReflector $reflector
  21. * @param Context $context
  22. * @param array $config
  23. */
  24. public function __construct($reflector = null, $context = null, $config = [])
  25. {
  26. parent::__construct($reflector, $context, $config);
  27. if ($reflector === null) {
  28. return;
  29. }
  30. foreach ($this->tags as $i => $tag) {
  31. if ($tag->getName() == 'event') {
  32. $eventTag = new ReturnTag('event', $tag->getContent(), $tag->getDocBlock(), $tag->getLocation());
  33. $this->type = $eventTag->getType();
  34. $this->types = $eventTag->getTypes();
  35. $this->description = static::mbUcFirst($eventTag->getDescription());
  36. $this->shortDescription = BaseDoc::extractFirstSentence($this->description);
  37. unset($this->tags[$i]);
  38. }
  39. }
  40. }
  41. }