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

Editor   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 38
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0
wmc 9
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B openWith() 0 24 9
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 8
    public static function openWith($editor = 'subl')
19
    {
20 8
        switch (strtolower($editor)) {
21 8
            case 'phpstorm':
22 1
                return 'phpstorm://open?file=%file&line=%line';
23
24 7
            case 'vscode':
25 2
                return 'vscode://file/%file:%line';
26
27 5
            case 'mvim':
28 5
            case 'macvim':
29 1
                return 'mvim://open/?url=file://%file&line=%line';
30
31 4
            case 'txmt':
32 4
            case 'textmate':
33 1
                return 'txmt://open/?url=file://%file&line=%line';
34
35 3
            case 'subl':
36 2
            case 'sublime':
37 2
                return 'subl://open?url=file://%file&line=%line';
38
        }
39
40 1
        return 'editor://open/?file=%file&line=%line';
41
    }
42
}
43