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.
45 lines
961 B
45 lines
961 B
11 years ago
|
<?php
|
||
11 years ago
|
/**
|
||
|
* @link http://www.yiiframework.com/
|
||
|
* @copyright Copyright (c) 2008 Yii Software LLC
|
||
|
* @license http://www.yiiframework.com/license/
|
||
|
*/
|
||
11 years ago
|
|
||
11 years ago
|
namespace yii\apidoc\models;
|
||
11 years ago
|
|
||
|
use yii\base\Object;
|
||
|
|
||
|
class BaseDoc extends Object
|
||
|
{
|
||
|
public $name;
|
||
|
|
||
|
public $since;
|
||
|
|
||
|
public $shortDescription;
|
||
|
public $description;
|
||
|
|
||
|
public $sourceFile;
|
||
|
public $startLine;
|
||
|
public $endLine;
|
||
|
|
||
|
public function loadSource($reflection)
|
||
|
{
|
||
|
$this->sourcePath=str_replace('\\','/',str_replace(YII_PATH,'',$reflection->getFileName()));
|
||
|
$this->startLine=$reflection->getStartLine();
|
||
|
$this->endLine=$reflection->getEndLine();
|
||
|
}
|
||
|
|
||
|
public function getSourceUrl($baseUrl,$line=null)
|
||
|
{
|
||
|
if($line===null)
|
||
|
return $baseUrl.$this->sourcePath;
|
||
|
else
|
||
|
return $baseUrl.$this->sourcePath.'#'.$line;
|
||
|
}
|
||
|
|
||
|
public function getSourceCode()
|
||
|
{
|
||
|
$lines=file(YII_PATH.$this->sourcePath);
|
||
|
return implode("",array_slice($lines,$this->startLine-1,$this->endLine-$this->startLine+1));
|
||
|
}
|
||
|
}
|