Code Duplication    Length = 10-10 lines in 2 locations

src/models/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
                static::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
    }
@@ 146-155 (lines=10) @@
143
        $json = Json::encode($data);
144
        $hash = hash('sha256', $json);
145
        $path = $this->buildHashedPath('provider-latest', $hash);
146
        if (!file_exists($path)) {
147
            $this->getLocker()->lock();
148
            {
149
                static::mkdir(dirname($path));
150
                file_put_contents($path, $json);
151
                file_put_contents($latest_path, $json);
152
                $this->writePackagesJson($hash);
153
            }
154
            $this->getLocker()->release();
155
        }
156
157
        return $hash;
158
    }