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

Editor   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 60%

Importance

Changes 0
Metric Value
dl 0
loc 39
ccs 9
cts 15
cp 0.6
rs 10
c 0
b 0
f 0
wmc 9
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B use() 0 25 9
1
<?php
2
3
namespace Recca0120\LaravelTracy;
4
5
class Editor
6
{
7
    /**
8
     * Editor protocol.
9
     *
10
     * Usage:
11
     *      Editor::use('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|null
17
     */
18 1
    public static function use($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