Completed
Pull Request — master (#51)
by
unknown
01:38
created

Editor::openWith()   B

Complexity

Conditions 9
Paths 9

Size

Total Lines 25

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 14.184

Importance

Changes 0
Metric Value
cc 9
nc 9
nop 1
dl 0
loc 25
ccs 9
cts 15
cp 0.6
crap 14.184
rs 8.0555
c 0
b 0
f 0
1
<?php
2
3
namespace Recca0120\LaravelTracy;
4
5
class Editor
6
{
7
    /**
8
     * Editor protocol.
9
     *
10
     * Usage:
11
     *      Editor::openWith('vscode')
12
     *
13
     * https://tracy.nette.org/en/open-files-in-ide
14
     *
15
     * @param string $editor (sublime|subl, phpstorm, vscode, macvim|mvim, textmate|txmt)
16
     * @return string
17
     */
18 1
    public static function openWith($editor = 'sublime')
19
    {
20
        switch ($editor) {
21 1
            case 'phpstorm':
22
                return 'phpstorm://open?file=%file&line=%line';
23
24 1
            case 'vscode':
25
                return 'vscode://file/%file:%line';
26
27 1
            case 'mvim':
28 1
            case 'macvim':
29
                return 'mvim://open/?url=file://%file&line=%line';
30
31 1
            case 'txmt':
32 1
            case 'textmate':
33
                return 'txmt://open/?url=file://%file&line=%line';
34
35 1
            case 'subl':
36
            case 'sublime':
37 1
                return 'subl://open?url=file://%file&line=%line';
38
39
            defualt:
0 ignored issues
show
Unused Code introduced by
defualt: does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
40
                return 'editor://open/?file=%file&line=%line';
41
        }
42
    }
43
}
44