Code Duplication    Length = 10-10 lines in 2 locations

src/Commands/ServerAddCommand.php 1 location

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

src/Commands/ServerListCommand.php 1 location

@@ 42-51 (lines=10) @@
39
    {
40
        $command = new Style($input, $output);
41
42
        if (! file_exists($file = $this->getHomeDir() . "/.Josh/servers.json")) {
43
44
            if (! is_dir($dir = $this->getHomeDir() . "/.Josh")) {
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