phalconplus Documentation v1.2.0
Class
Class PhalconPlus Enum

# RunMode

        //  className
        // eg: mode "Web" has a module initial className in app/Module.php
        protected mapClasses = [
            "Web"     : "Web",
            "Cli"     : "Cli",
            "Srv"     : "Srv",
            "Micro"   : "Micro"
        ];

        // 全局服务加载脚本定义
        protected scripts = [
            "Web"   : "/default-web.php",
            "Cli"   : "/default-cli.php",
            "Srv"   : "/default-web.php",
            "Micro" : "/default-micro.php"
        ];

        public function getScriptPath() -> string | null
        {
            var script;
            let script = Sys::getGlobalLoadDir() . this->scripts[this->val];
            if !is_file(script) {
                error_log("PHP Notice:  PhalconPlus\\Enum\\RunMode Global load file not exists: " . script);
                return null;
            }
            return script;
        }

        public function isCli()
        {
            return this->val == RunMode::CLI;
        }

        public function isWeb()
        {
            return this->val == RunMode::WEB;
        }

        public function isSrv()
        {
            return this->val == RunMode::SRV;
        }

        public function isMicro()
        {
            return this->val == RunMode::MICRO;
        }

        public function getMapClassName() -> string
        {
            return this->mapClasses[this->val];
        }
    }