Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
52 | public function unlock($name) |
||
53 | { |
||
54 | if (!in_array($name, $this->locks)) { |
||
55 | throw new Exception("Lock $name was already registered"); |
||
56 | } |
||
57 | |||
58 | foreach ($this->locks as $i => $candidate) { |
||
59 | if ($candidate == $name) { |
||
60 | unset($this->locks[$i]); |
||
61 | $this->redis->del("lock-$name"); |
||
62 | break; |
||
63 | } |
||
64 | } |
||
65 | |||
66 | $this->locks = array_values($this->locks); |
||
67 | } |
||
68 | |||
77 |