TraitDoc.php 952 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 19 20 21
    // classes using the trait
    // will be set by Context::updateReferences()
    public $usedBy = [];
    public $traits = [];
22

23

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

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

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