TraitDoc.php 866 Bytes
Newer Older
1 2
<?php
/**
3 4 5
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
6 7
 */

8
namespace yii\apidoc\models;
9

10
/**
11
 * Represents API documentation information for a `trait`.
12 13 14 15
 *
 * @author Carsten Brandt <mail@cebe.cc>
 * @since 2.0
 */
16
class TraitDoc extends TypeDoc
17 18
{
	// classes using the trait
19 20
	// will be set by Context::updateReferences()
	public $usedBy = [];
21 22 23 24 25

	public $traits = [];

	/**
	 * @param \phpDocumentor\Reflection\TraitReflector $reflector
26
	 * @param Context $context
27 28
	 * @param array $config
	 */
29
	public function __construct($reflector = null, $context = null, $config = [])
30
	{
31
		parent::__construct($reflector, $context, $config);
32

33 34 35 36
		if ($reflector === null) {
			return;
		}

37 38 39 40 41
		foreach($reflector->getTraits() as $trait) {
			$this->traits[] = ltrim($trait, '\\');
		}
	}
}