Code Duplication    Length = 10-10 lines in 2 locations

src/components/Storage.php 2 locations

@@ 88-97 (lines=10) @@
85
        $json = Json::encode($data);
86
        $hash = hash('sha256', $json);
87
        $path = $this->buildHashedPath($name, $hash);
88
        if (!file_exists($path)) {
89
            $this->getLocker()->lock();
90
            {
91
                $this->mkdir(dirname($path));
92
                file_put_contents($path, $json);
93
                file_put_contents($this->buildHashedPath($name), $json);
94
                $this->writeProviderLatest($name, $hash);
95
            }
96
            $this->getLocker()->release();
97
        }
98
99
        return $hash;
100
    }
@@ 150-159 (lines=10) @@
147
        $json = Json::encode($data);
148
        $hash = hash('sha256', $json);
149
        $path = $this->buildHashedPath('provider-latest', $hash);
150
        if (!file_exists($path)) {
151
            $this->getLocker()->lock();
152
            {
153
                $this->mkdir(dirname($path));
154
                file_put_contents($path, $json);
155
                file_put_contents($latest_path, $json);
156
                $this->writePackagesJson($hash);
157
            }
158
            $this->getLocker()->release();
159
        }
160
161
        return $hash;
162
    }