Passed
Push — master ( a81e56...f8f96d )
by wen
07:57 queued 06:20
created
src/Lock.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public function acquireLock(string $lockName, $acquireTimeout = 10, $lockTimeout = 10)
26 26
     {
27
-        $lockName = 'lock:' . $lockName;
27
+        $lockName = 'lock:'.$lockName;
28 28
         $identifier = $this->getIdentifier();
29 29
         $end = time() + $acquireTimeout;
30 30
         while (time() < $end) {
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function releaseLock(string $lockName, string $identifier)
49 49
     {
50
-        $lockName = 'lock:' . $lockName;
50
+        $lockName = 'lock:'.$lockName;
51 51
         while (true) {
52 52
             $this->redis->watch($lockName);
53 53
             if ($this->redis->get($lockName) == $identifier) {
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
     {
77 77
         $identifier = $this->getIdentifier();
78 78
         $microTime = $this->microTimeFloat();
79
-        $ownerZset = $semname . ':owner';
80
-        $counterStr = $semname . ':counter';
79
+        $ownerZset = $semname.':owner';
80
+        $counterStr = $semname.':counter';
81 81
 
82 82
         // 清理过期的信号量持有者
83 83
         $this->redis->zremrangebyscore($semname, '-inf', $microTime + $timeout);
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
     public function releaseFairSemaphore($semname, $identifier)
110 110
     {
111 111
         $this->redis->zrem($semname, $identifier);
112
-        $ownerZset = $semname . ':owner';
113
-        return (bool)$this->redis->zrem($ownerZset, $identifier);
112
+        $ownerZset = $semname.':owner';
113
+        return (bool) $this->redis->zrem($ownerZset, $identifier);
114 114
     }
115 115
 
116 116
     /**
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     protected function microTimeFloat()
156 156
     {
157 157
         list($usec, $sec) = explode(' ', microtime());
158
-        return ((float)$usec + (float)$sec);
158
+        return ((float) $usec + (float) $sec);
159 159
     }
160 160
 
161 161
     protected function getIdentifier()
Please login to merge, or discard this patch.