| Total Complexity | 6 |
| Total Lines | 66 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class IndexFinder |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * 入口文件 |
||
| 11 | * |
||
| 12 | * @var string |
||
| 13 | */ |
||
| 14 | protected $indexFile; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * 文本根目录 |
||
| 18 | * |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | protected $documentRoot; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * 入口文件 |
||
| 25 | * |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | protected $entranceFile; |
||
| 29 | |||
| 30 | public function __construct(?string $entranceFile = null, ?string $documentRoot = null) |
||
| 31 | { |
||
| 32 | $this->entranceFile = $entranceFile ?? \get_included_files()[0]; |
||
| 33 | $this->documentRoot = $documentRoot ?? $_SERVER['DOCUMENT_ROOT']; |
||
| 34 | } |
||
| 35 | |||
| 36 | |||
| 37 | /** |
||
| 38 | * 入口文件 |
||
| 39 | * |
||
| 40 | * @return string |
||
| 41 | */ |
||
| 42 | private function getEntranceFile():string |
||
| 43 | { |
||
| 44 | return $this->entranceFile; |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * 引导文件 |
||
| 49 | * |
||
| 50 | * @return string |
||
| 51 | */ |
||
| 52 | public function getIndexFile():string |
||
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * Get 文本根目录 |
||
| 67 | * |
||
| 68 | * @return string |
||
| 69 | */ |
||
| 70 | public function getDocumentRoot() |
||
| 73 | } |
||
| 74 | } |
||
| 75 |