Total Complexity | 6 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | final class DocumentLockManager implements DocumentLockManagerInterface |
||
17 | { |
||
18 | private CacheItemPoolInterface $cache; |
||
19 | |||
20 | public function __construct(CacheItemPoolInterface $cache) |
||
23 | } |
||
24 | |||
25 | public function deleteLock(string $documentId, RequestInterface $request): bool |
||
26 | { |
||
27 | return $this->cache->deleteItem($this->getCacheId($documentId)); |
||
28 | } |
||
29 | |||
30 | public function getLock(string $documentId, RequestInterface $request): string |
||
31 | { |
||
32 | return $this->cache->getItem($this->getCacheId($documentId))->get(); |
||
33 | } |
||
34 | |||
35 | public function hasLock(string $documentId, RequestInterface $request): bool |
||
36 | { |
||
37 | $item = $this->cache->getItem($this->getCacheId($documentId)); |
||
38 | |||
39 | return $item->isHit(); |
||
40 | } |
||
41 | |||
42 | public function setLock(string $documentId, string $lockId, RequestInterface $request): bool |
||
49 | } |
||
50 | |||
51 | private function getCacheId(string $documentId): string |
||
52 | { |
||
56 |