private static function isCli()
    {
        if (self::$cli === null) {
            //initial setter
            if (php_sapi_name() == 'cli') {
                self::$cli = true;
            } else {
                self::$cli = false;
            }
        }

        return self::$cli;
    }