You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.1 KiB
53 lines
1.1 KiB
<?php |
|
/** |
|
* @link http://www.yiiframework.com/ |
|
* @copyright Copyright (c) 2008 Yii Software LLC |
|
* @license http://www.yiiframework.com/license/ |
|
*/ |
|
|
|
namespace yii\apidoc\models; |
|
|
|
use phpDocumentor\Reflection\FileReflector; |
|
use yii\base\Object; |
|
|
|
class File extends Object |
|
{ |
|
public $name; |
|
|
|
public $namespaces = []; |
|
/** |
|
* @var ClassDoc[] |
|
*/ |
|
public $classes = []; |
|
/** |
|
* @var InterfaceDoc[] |
|
*/ |
|
public $interfaces = []; |
|
/** |
|
* @var TraitDoc[] |
|
*/ |
|
public $traits = []; |
|
|
|
private $_reflection; |
|
|
|
public function __construct($fileName, $context, $config = []) |
|
{ |
|
$this->name = $fileName; |
|
$this->_reflection = new FileReflector($fileName, true); |
|
$this->_reflection->process(); |
|
|
|
foreach($this->_reflection->getClasses() as $class) { |
|
$class = new ClassDoc($class, $context); |
|
$class->sourceFile = $fileName; |
|
$this->classes[] = $class; |
|
} |
|
foreach($this->_reflection->getInterfaces() as $interface) { |
|
$this->interfaces[] = new InterfaceDoc($interface, $context); |
|
} |
|
foreach($this->_reflection->getTraits() as $trait) { |
|
$this->traits[] = new TraitDoc($trait, $context); |
|
} |
|
|
|
parent::__construct($config); |
|
} |
|
} |