. * *///}}} declare(strict_types=1); namespace rabe\Util; class Instance { private SplFileInfo $fileInfo; public function __construct(SplFileInfo $fileInfo) { $this->fileInfo = $fileInfo; } public function __get(string $property) { switch ($property) { case 'name': return $this->fileInfo->getBaseName(); case 'basePath': return $this->fileInfo->getPathname(); case 'webRoot': return $this->getWebRoot(); case 'configPath': return $this->getConfigPath(); } } public function getWebRoot() { $webRoot = $this->basePath; if (file_exists("$webRoot/public")) { $webRoot .= '/public'; } if (file_exists("$webRoot/httpsdocs")) { $webRoot .= '/httpsdocs'; } return $webRoot; } public function getConfigPath() { return $this->webRoot . '/config'; } }