| Conditions | 2 | 
| Paths | 2 | 
| Total Lines | 13 | 
| Code Lines | 8 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 5 | 
| CRAP Score | 2.2109 | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 41 | 7 | public function transaction(Client $predis, string $key, int $ttl, \Closure $closure)  | 
            |
| 42 |     { | 
            ||
| 43 | 7 | $this->lock($predis, $key, $ttl);  | 
            |
| 44 |         try { | 
            ||
| 45 | 7 | $res = $closure();  | 
            |
| 46 |         } catch (\Exception | \Throwable $e) { | 
            ||
| 47 | $this->unlock($predis, $key);  | 
            ||
| 48 | throw $e;  | 
            ||
| 49 | }  | 
            ||
| 50 | // Unlock in correct flow.  | 
            ||
| 51 | 7 | $this->unlock($predis, $key);  | 
            |
| 52 | |||
| 53 | 7 | return $res;  | 
            |
| 54 | }  | 
            ||
| 56 |