Code Duplication    Length = 11-14 lines in 2 locations

src/Infrastructure/FLockerStore.php 2 locations

@@ 52-62 (lines=11) @@
49
     * @param Lock $lock
50
     * @throws ExistingKeyException
51
     */
52
    public function acquire(Lock $lock)
53
    {
54
        $key = $lock->key();
55
        $fileName = $this->getLockPath($key);
56
57
        if (file_exists($fileName)) {
58
            throw new ExistingKeyException(sprintf('The key "%s" already exists.', $key));
59
        }
60
61
        $this->save($lock, $fileName);
62
    }
63
64
    /**
65
     * @param Lock $lock
@@ 170-183 (lines=14) @@
167
     * @throws LockingKeyException
168
     * @throws NotExistingKeyException
169
     */
170
    public function update($key, $payload)
171
    {
172
        $fileName = $this->getLockPath($key);
173
174
        if (!file_exists($fileName)) {
175
            throw new NotExistingKeyException(sprintf('The key "%s" does not exists.', $key));
176
        }
177
178
        /** @var Lock $lock */
179
        $lock = $this->get($key);
180
        $lock->update($payload);
181
182
        $this->save($lock, $fileName);
183
    }
184
}
185