Code Duplication    Length = 10-10 lines in 2 locations

src/models/Storage.php 2 locations

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