Code Duplication    Length = 19-20 lines in 2 locations

src/Service.php 2 locations

@@ 65-84 (lines=20) @@
62
        return true;
63
    }
64
65
    private function store($path, $value = null)
66
    {
67
        $chain = explode('/', $path);
68
69
        $key = array_pop($chain);
70
        $folder = implode('/', $chain);
71
72
        $this->client->setRoot($folder);
73
        try {
74
            $this->client->ls('.');
75
        } catch(Exception $e) {
76
            $this->client->mkdir('.');
77
        }
78
79
        try {
80
            $this->client->get($key);
81
        } catch(Exception $e) {
82
            $this->client->set($key, $value);
83
        }
84
    }
85
86
    private function remove($path)
87
    {
@@ 86-104 (lines=19) @@
83
        }
84
    }
85
86
    private function remove($path)
87
    {
88
        $chain = explode('/', $path);
89
90
        $key = array_pop($chain);
91
        $folder = implode('/', $chain);
92
93
        $this->client->setRoot($folder);
94
        try {
95
            $this->client->ls('.');
96
        } catch(Exception $e) {
97
            $this->client->mkdir('.');
98
        }
99
100
        try {
101
            $this->client->remove($key);
102
        } catch(Exception $e) {
103
        }
104
    }
105
}
106