Ts\Helper\AppInstall::__construct PHP Method

__construct() protected method

构造方法
Author: Seven Du ([email protected])
protected __construct ( )
    protected function __construct()
    {
        if (!self::$appName) {
            throw new Exception('没有传递需要初始化的应用!', 1);
        }
        $handle = opendir(TS_APPLICATION);
        while (($file = readdir($handle)) !== false) {
            if (strtolower($file) == self::$appName) {
                self::$applicationDir = TS_APPLICATION . Ts::DS . $file;
                break;
            }
        }
        closedir($handle);
        $manageFile = self::$applicationDir . Ts::DS . 'manage.json';
        if (!self::$applicationDir) {
            throw new Exception('应用:“' . self::$appName . '”不存在!', 1);
        } elseif (!Filesystem::exists($manageFile)) {
            throw new Exception(sprintf('不存在应用配置文件:“%s”', $manageFile));
        }
        self::$appInfo = file_get_contents($manageFile);
        self::$appInfo = json_decode(self::$appInfo, true);
        if (!isset(self::$appInfo['resource'])) {
            self::$appInfo['resource'] = '_static';
        }
    }