TraitDoc.php 952 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. /**
  9. * Represents API documentation information for a `trait`.
  10. *
  11. * @author Carsten Brandt <mail@cebe.cc>
  12. * @since 2.0
  13. */
  14. class TraitDoc extends TypeDoc
  15. {
  16. // classes using the trait
  17. // will be set by Context::updateReferences()
  18. public $usedBy = [];
  19. public $traits = [];
  20. /**
  21. * @param \phpDocumentor\Reflection\TraitReflector $reflector
  22. * @param Context $context
  23. * @param array $config
  24. */
  25. public function __construct($reflector = null, $context = null, $config = [])
  26. {
  27. parent::__construct($reflector, $context, $config);
  28. if ($reflector === null) {
  29. return;
  30. }
  31. foreach ($reflector->getTraits() as $trait) {
  32. $this->traits[] = ltrim($trait, '\\');
  33. }
  34. }
  35. }