Passed
Push — master ( 9e6899...da3b7a )
by Hong
04:53
created
src/Adaptor/FileAdaptor.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -38,13 +38,13 @@  discard block
 block discarded – undo
38 38
         int $hashLevel = 2
39 39
     ) {
40 40
         if (empty($rootPath)) {
41
-            $rootPath = \sys_get_temp_dir() . \DIRECTORY_SEPARATOR . 'phoole_cache';
41
+            $rootPath = \sys_get_temp_dir().\DIRECTORY_SEPARATOR.'phoole_cache';
42 42
         }
43 43
 
44 44
         if (!file_exists($rootPath) && !@mkdir($rootPath, 0777, true)) {
45 45
             throw new \RuntimeException("Failed to create $rootPath");
46 46
         }
47
-        $this->rootPath = realpath($rootPath) . \DIRECTORY_SEPARATOR;
47
+        $this->rootPath = realpath($rootPath).\DIRECTORY_SEPARATOR;
48 48
         $this->hashLevel = $hashLevel;
49 49
     }
50 50
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     {
116 116
         $path = rtrim($this->getRoot(), '/\\');
117 117
         if (file_exists($path)) {
118
-            $temp = $path . '_' . substr(md5($path . microtime(true)), -5);
118
+            $temp = $path.'_'.substr(md5($path.microtime(true)), -5);
119 119
             return rename($path, $temp) && mkdir($path, 0777, true);
120 120
         }
121 121
         return false;
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         $this->rmDir($root, true);
132 132
 
133 133
         // remove staled directory
134
-        $pattern = rtrim($root, '/\\') . '_*';
134
+        $pattern = rtrim($root, '/\\').'_*';
135 135
         foreach (glob($pattern, GLOB_MARK) as $dir) {
136 136
             $this->rmDir($dir);
137 137
         }
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
     protected function getPath(string $key): string
153 153
     {
154 154
         // get hashed directory
155
-        $name = $key . '00';
155
+        $name = $key.'00';
156 156
         $path = $this->getRoot();
157 157
         for ($i = 0; $i < $this->hashLevel; ++$i) {
158
-            $path .= $name[$i] . \DIRECTORY_SEPARATOR;
158
+            $path .= $name[$i].\DIRECTORY_SEPARATOR;
159 159
         }
160 160
 
161 161
         // make sure hashed directory exists
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         }
165 165
 
166 166
         // return full path
167
-        return $path . $key;
167
+        return $path.$key;
168 168
     }
169 169
 
170 170
     /**
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      */
176 176
     protected function getLock(string $path)
177 177
     {
178
-        $lock = $path . '.lock';
178
+        $lock = $path.'.lock';
179 179
         $count = 0;
180 180
         if ($fp = fopen($lock, 'c')) {
181 181
             while (true) {
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      */
206 206
     protected function releaseLock(string $path, $fp): bool
207 207
     {
208
-        $lock = $path . '.lock';
208
+        $lock = $path.'.lock';
209 209
         return flock($fp, LOCK_UN) && fclose($fp) && unlink($lock);
210 210
     }
211 211
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
      */
218 218
     protected function rmDir(string $dir, bool $staleOnly = false)
219 219
     {
220
-        foreach (glob($dir . '{,.}[!.,!..]*', GLOB_MARK | GLOB_BRACE) as $file) {
220
+        foreach (glob($dir.'{,.}[!.,!..]*', GLOB_MARK | GLOB_BRACE) as $file) {
221 221
             if (is_dir($file)) {
222 222
                 $this->rmDir($file, $staleOnly);
223 223
             } else {
Please login to merge, or discard this patch.