Code coverage report for out/src/controllers/CommandController.js

# All files / out/src/controllers CommandController.js

68.57% Statements 24/35
33.33% Branches 6/18
66.67% Functions 4/6
68.57% Lines 24/35

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    1x
    1x
    1x

    10x

    6x

    6x

    1x
    1x
    1x

    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x

    6x

    1x
     "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    const vscode = require("vscode");
    const Server_1 = require("../Server");
    class CommandController {
        constructor(context) {
            this.context = context;
        }
        serveProject() {
            Iif (this.server && this.server.isRunning()) {
                vscode.window.showErrorMessage('Server is already running!');
                return;
            }
            this.createServer(this.context.extensionPath);
        }
        reloadServer() {
            const reloading = this.server && this.server.isRunning();
            if (this.server) {
                this.server.shutDown();
            }
            this.createServer(this.context.extensionPath, reloading);
        }
        openFileInBrowser() {
            Eif (!this.server || !this.server.isRunning()) {
                vscode.window.showErrorMessage('Server is not running!');
                return;
            }
            const config = vscode.workspace.getConfiguration('phpserver');
            this.server.execBrowser(config.get('browser'), this.context.getActiveFileName());
        }
        stopServer() {
            if (this.server) {
                this.server.shutDown();
            }
        }
        createServer(extensionPath, reloading) {
            const config = vscode.workspace.getConfiguration('phpserver');
            const relativePath = config.get('relativePath');
            const router = config.get('router');
            const phpPath = config.get('phpPath');
            const phpConfigPath = config.get('phpConfigPath');
            const port = config.get('port');
            const ip = config.get('ip');
            this.server = new Server_1.default(ip, port, relativePath, extensionPath);
            this.server.setRouter(router);
            this.server.setPhpPath(phpPath);
            this.server.setPhpConfigPath(phpConfigPath);
            this.server.run();
            Iif (reloading && !config.get('autoOpenOnReload')) {
                return;
            }
            this.server.execBrowser(config.get('browser'), this.context.getActiveFileName());
        }
    }
    exports.default = CommandController;
    //# sourceMappingURL=CommandController.js.map