TraitDoc.php 811 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 26 27

	public $traits = [];

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

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

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