Code Duplication    Length = 10-10 lines in 2 locations

src/Commands/ServerAddCommand.php 1 location

@@ 45-54 (lines=10) @@
42
    {
43
        $command = new Style($input, $output);
44
45
        if (! file_exists($file = package_path("servers.json"))) {
46
47
            if (! is_dir($dir = package_path())) {
48
                mkdir($dir,0777);
49
            }
50
51
            touch($file);
52
            chmod($file,0777);
53
            file_put_contents($file,json_encode([]));
54
        }
55
56
        $servers = json_decode(file_get_contents($file), true);
57

src/Commands/ServerListCommand.php 1 location

@@ 42-51 (lines=10) @@
39
    {
40
        $command = new Style($input, $output);
41
42
        if (! file_exists($file = package_path("servers.json"))) {
43
44
            if (! is_dir($dir = package_path())) {
45
                mkdir($dir,0777);
46
            }
47
48
            touch($file);
49
            chmod($file,0777);
50
            file_put_contents($file,json_encode([]));
51
        }
52
53
        $servers = json_decode(file_get_contents($file), true);
54