Code Duplication    Length = 10-10 lines in 2 locations

src/components/Storage.php 2 locations

@@ 90-99 (lines=10) @@
87
        $json = Json::encode($data);
88
        $hash = hash('sha256', $json);
89
        $path = $this->buildHashedPath($name, $hash);
90
        if (!file_exists($path)) {
91
            $this->getLocker()->lock();
92
            {
93
                static::mkdir(dirname($path));
94
                file_put_contents($path, $json);
95
                file_put_contents($this->buildHashedPath($name), $json);
96
                $this->writeProviderLatest($name, $hash);
97
            }
98
            $this->getLocker()->release();
99
        }
100
101
        return $hash;
102
    }
@@ 159-168 (lines=10) @@
156
        $json = Json::encode($data);
157
        $hash = hash('sha256', $json);
158
        $path = $this->buildHashedPath('provider-latest', $hash);
159
        if (!file_exists($path)) {
160
            $this->getLocker()->lock();
161
            {
162
                static::mkdir(dirname($path));
163
                file_put_contents($path, $json);
164
                file_put_contents($latest_path, $json);
165
                $this->writePackagesJson($hash);
166
            }
167
            $this->getLocker()->release();
168
        }
169
170
        return $hash;
171
    }