Code Duplication    Length = 10-10 lines in 2 locations

src/components/Storage.php 2 locations

@@ 79-88 (lines=10) @@
76
        $json = Json::encode($data);
77
        $hash = hash('sha256', $json);
78
        $path = $this->buildHashedPath($name, $hash);
79
        if (!file_exists($path)) {
80
            $this->getLocker()->lock();
81
            {
82
                static::mkdir(dirname($path));
83
                file_put_contents($path, $json);
84
                file_put_contents($this->buildHashedPath($name), $json);
85
                $this->writeProviderLatest($name, $hash);
86
            }
87
            $this->getLocker()->release();
88
        }
89
90
        return $hash;
91
    }
@@ 148-157 (lines=10) @@
145
        $json = Json::encode($data);
146
        $hash = hash('sha256', $json);
147
        $path = $this->buildHashedPath('provider-latest', $hash);
148
        if (!file_exists($path)) {
149
            $this->getLocker()->lock();
150
            {
151
                static::mkdir(dirname($path));
152
                file_put_contents($path, $json);
153
                file_put_contents($latest_path, $json);
154
                $this->writePackagesJson($hash);
155
            }
156
            $this->getLocker()->release();
157
        }
158
159
        return $hash;
160
    }