Completed
Push — V6 ( 23eee8...7e10de )
by Georges
02:57
created
src/phpFastCache/Core/Pool/DriverBaseTrait.php 4 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -159,9 +159,9 @@
 block discarded – undo
159 159
     public function driverPreWrap(ExtendedCacheItemInterface $item)
160 160
     {
161 161
         $wrap = [
162
-          self::DRIVER_DATA_WRAPPER_INDEX => $item->get(),
163
-          self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(),
164
-          self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(),
162
+            self::DRIVER_DATA_WRAPPER_INDEX => $item->get(),
163
+            self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(),
164
+            self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(),
165 165
         ];
166 166
 
167 167
         if($this->config['itemDetailedDate']){
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -273,7 +273,7 @@
 block discarded – undo
273 273
         
274 274
         if (!is_dir($path)) {
275 275
             throw new phpFastCacheDriverException("Can't read PATH:" . $path, 94);
276
-        }else{
276
+        } else{
277 277
             $size = Directory::dirSize($path);
278 278
         }
279 279
 
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         if (is_array($config_name)) {
53 53
             $this->config = array_merge($this->config, $config_name);
54 54
         } else {
55
-            $this->config[ $config_name ] = $value;
55
+            $this->config[$config_name] = $value;
56 56
         }
57 57
     }
58 58
 
@@ -164,16 +164,16 @@  discard block
 block discarded – undo
164 164
           self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(),
165 165
         ];
166 166
 
167
-        if($this->config['itemDetailedDate']){
168
-            $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = new \DateTime();
167
+        if ($this->config['itemDetailedDate']) {
168
+            $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = new \DateTime();
169 169
             /**
170 170
              * If the creation date exists
171 171
              * reuse it else set a new Date
172 172
              */
173
-            $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = $item->getCreationDate() ?: new \DateTime();
174
-        }else{
175
-            $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = null;
176
-            $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = null;
173
+            $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = $item->getCreationDate() ?: new \DateTime();
174
+        } else {
175
+            $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = null;
176
+            $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = null;
177 177
         }
178 178
 
179 179
         return $wrap;
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      */
186 186
     public function driverUnwrapData(array $wrapper)
187 187
     {
188
-        return $wrapper[ self::DRIVER_DATA_WRAPPER_INDEX ];
188
+        return $wrapper[self::DRIVER_DATA_WRAPPER_INDEX];
189 189
     }
190 190
 
191 191
     /**
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
      */
195 195
     public function driverUnwrapTags(array $wrapper)
196 196
     {
197
-        return $wrapper[ self::DRIVER_TAGS_WRAPPER_INDEX ];
197
+        return $wrapper[self::DRIVER_TAGS_WRAPPER_INDEX];
198 198
     }
199 199
 
200 200
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
      */
205 205
     public function driverUnwrapEdate(array $wrapper)
206 206
     {
207
-        return $wrapper[ self::DRIVER_EDATE_WRAPPER_INDEX ];
207
+        return $wrapper[self::DRIVER_EDATE_WRAPPER_INDEX];
208 208
     }
209 209
 
210 210
     /**
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
      */
214 214
     public function driverUnwrapCdate(array $wrapper)
215 215
     {
216
-        return $wrapper[ self::DRIVER_CDATE_WRAPPER_INDEX ];
216
+        return $wrapper[self::DRIVER_CDATE_WRAPPER_INDEX];
217 217
     }
218 218
 
219 219
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      */
224 224
     public function driverUnwrapMdate(array $wrapper)
225 225
     {
226
-        return $wrapper[ self::DRIVER_MDATE_WRAPPER_INDEX ];
226
+        return $wrapper[self::DRIVER_MDATE_WRAPPER_INDEX];
227 227
     }
228 228
 
229 229
     /**
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
          * on tags item, it can leads
249 249
          * to an infinite recursive calls
250 250
          */
251
-        if(strpos($item->getKey(), self::DRIVER_TAGS_KEY_PREFIX ) === 0){
251
+        if (strpos($item->getKey(), self::DRIVER_TAGS_KEY_PREFIX) === 0) {
252 252
             throw new \LogicException('Trying to set tag(s) to an Tag item index: ' . $item->getKey());
253 253
         }
254 254
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
         foreach ($tagsItems as $tagsItem) {
292 292
             $data = (array) $tagsItem->get();
293 293
 
294
-            unset($data[ $item->getKey() ]);
294
+            unset($data[$item->getKey()]);
295 295
             $tagsItem->set($data);
296 296
 
297 297
             /**
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -13,9 +13,7 @@
 block discarded – undo
13 13
  */
14 14
 namespace phpFastCache\Core\Pool;
15 15
 
16
-use phpFastCache\Exceptions\phpFastCacheDriverException;
17 16
 use phpFastCache\Core\Item\ExtendedCacheItemInterface;
18
-use phpFastCache\Util\Directory;
19 17
 
20 18
 
21 19
 /**
Please login to merge, or discard this patch.
src/phpFastCache/Core/Pool/IO/IOHelperTrait.php 4 patches
Doc Comments   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,7 +26,6 @@  discard block
 block discarded – undo
26 26
     public $tmp = [];
27 27
 
28 28
     /**
29
-     * @param bool $skip_create_path
30 29
      * @param $config
31 30
      * @return string
32 31
      * @throws phpFastCacheIOException
@@ -135,7 +134,7 @@  discard block
 block discarded – undo
135 134
     }
136 135
 
137 136
     /**
138
-     * @param $keyword
137
+     * @param string|false $keyword
139 138
      * @param bool $skip
140 139
      * @return string
141 140
      * @throws phpFastCacheIOException
@@ -181,7 +180,7 @@  discard block
 block discarded – undo
181 180
 
182 181
     /**
183 182
      * @param $filename
184
-     * @return mixed
183
+     * @return string
185 184
      */
186 185
     protected static function cleanFileName($filename)
187 186
     {
@@ -196,7 +195,7 @@  discard block
 block discarded – undo
196 195
     }
197 196
 
198 197
     /**
199
-     * @param $path
198
+     * @param string $path
200 199
      * @param bool $create
201 200
      * @throws phpFastCacheIOException
202 201
      */
@@ -230,7 +229,7 @@  discard block
 block discarded – undo
230 229
 
231 230
 
232 231
     /**
233
-     * @param $file
232
+     * @param string $file
234 233
      * @return string
235 234
      * @throws phpFastCacheIOException
236 235
      */
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
     protected static function cleanFileName($filename)
187 187
     {
188 188
         $regex = [
189
-          '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/',
190
-          '/\.$/',
191
-          '/^\./',
189
+            '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/',
190
+            '/\.$/',
191
+            '/^\./',
192 192
         ];
193 193
         $replace = ['-', '', ''];
194 194
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
             $tmpFilename = Directory::getAbsolutePath(dirname($file) . '/tmp_' . md5(
278 278
                 str_shuffle(uniqid($this->getDriverName(), false))
279 279
                 . str_shuffle(uniqid($this->getDriverName(), false))
280
-              ));
280
+                ));
281 281
 
282 282
             $f = fopen($tmpFilename, 'w+');
283 283
             flock($f, LOCK_EX);
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -35,30 +35,30 @@  discard block
 block discarded – undo
35 35
     {
36 36
         $tmp_dir = rtrim(ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir(), '\\/') . DIRECTORY_SEPARATOR . 'phpfastcache';
37 37
 
38
-        if (!isset($this->config[ 'path' ]) || $this->config[ 'path' ] == '') {
38
+        if (!isset($this->config['path']) || $this->config['path'] == '') {
39 39
             if (self::isPHPModule()) {
40 40
                 $path = $tmp_dir;
41 41
             } else {
42
-                $document_root_path = rtrim($_SERVER[ 'DOCUMENT_ROOT' ], '/') . '/../';
43
-                $path = isset($_SERVER[ 'DOCUMENT_ROOT' ]) && is_writable($document_root_path) ? $document_root_path : rtrim(__DIR__, '/') . 'PathSeekerTrait.php/';
42
+                $document_root_path = rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/../';
43
+                $path = isset($_SERVER['DOCUMENT_ROOT']) && is_writable($document_root_path) ? $document_root_path : rtrim(__DIR__, '/') . 'PathSeekerTrait.php/';
44 44
             }
45 45
 
46
-            if ($this->config[ 'path' ] != '') {
47
-                $path = $this->config[ 'path' ];
46
+            if ($this->config['path'] != '') {
47
+                $path = $this->config['path'];
48 48
             }
49 49
 
50 50
         } else {
51
-            $path = $this->config[ 'path' ];
51
+            $path = $this->config['path'];
52 52
         }
53 53
 
54 54
         if ($getBasePath === true) {
55 55
             return $path;
56 56
         }
57 57
 
58
-        $securityKey = array_key_exists('securityKey', $this->config) ? $this->config[ 'securityKey' ] : '';
58
+        $securityKey = array_key_exists('securityKey', $this->config) ? $this->config['securityKey'] : '';
59 59
         if (!$securityKey || $securityKey === 'auto') {
60
-            if (isset($_SERVER[ 'HTTP_HOST' ])) {
61
-                $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER[ 'HTTP_HOST' ])));
60
+            if (isset($_SERVER['HTTP_HOST'])) {
61
+                $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER['HTTP_HOST'])));
62 62
             } else {
63 63
                 $securityKey = ($this->isPHPModule() ? 'web' : 'cli');
64 64
             }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $full_pathx = md5($full_path);
75 75
 
76 76
 
77
-        if (!isset($this->tmp[ $full_pathx ])) {
77
+        if (!isset($this->tmp[$full_pathx])) {
78 78
 
79 79
             if (!@file_exists($full_path) || !@is_writable($full_path)) {
80 80
                 if (!@file_exists($full_path)) {
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
                 }
99 99
             }
100 100
 
101
-            $this->tmp[ $full_pathx ] = true;
102
-            $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config[ 'htaccess' ] : false);
101
+            $this->tmp[$full_pathx] = true;
102
+            $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config['htaccess'] : false);
103 103
         }
104 104
 
105 105
         return realpath($full_path);
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
      */
173 173
     public function setChmodAuto()
174 174
     {
175
-        if (!isset($this->config[ 'default_chmod' ]) || $this->config[ 'default_chmod' ] == '' || is_null($this->config[ 'default_chmod' ])) {
175
+        if (!isset($this->config['default_chmod']) || $this->config['default_chmod'] == '' || is_null($this->config['default_chmod'])) {
176 176
             return 0777;
177 177
         } else {
178
-            return $this->config[ 'default_chmod' ];
178
+            return $this->config['default_chmod'];
179 179
         }
180 180
     }
181 181
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         if ($create === true) {
206 206
             if (!is_writable($path)) {
207 207
                 try {
208
-                    if(!chmod($path, 0777)){
208
+                    if (!chmod($path, 0777)) {
209 209
                         throw new phpFastCacheIOException('Chmod failed on : ' . $path);
210 210
                     }
211 211
                 } catch (phpFastCacheIOException $e) {
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
          */
274 274
         $this->eventManager->dispatch('CacheWriteFileOnDisk', $this, $file, $secureFileManipulation);
275 275
 
276
-        if($secureFileManipulation){
276
+        if ($secureFileManipulation) {
277 277
             $tmpFilename = Directory::getAbsolutePath(dirname($file) . '/tmp_' . md5(
278 278
                 str_shuffle(uniqid($this->getDriverName(), false))
279 279
                 . str_shuffle(uniqid($this->getDriverName(), false))
@@ -285,10 +285,10 @@  discard block
 block discarded – undo
285 285
             flock($f, LOCK_UN);
286 286
             fclose($f);
287 287
 
288
-            if(!rename($tmpFilename, $file)){
288
+            if (!rename($tmpFilename, $file)) {
289 289
                 throw new phpFastCacheIOException(sprintf('Failed to rename %s to %s', $tmpFilename, $file));
290 290
             }
291
-        }else{
291
+        } else {
292 292
             $f = fopen($file, 'w+');
293 293
             $octetWritten = fwrite($f, $data);
294 294
             fclose($f);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -273,7 +273,7 @@
 block discarded – undo
273 273
         
274 274
         if (!is_dir($path)) {
275 275
             throw new phpFastCacheDriverException("Can't read PATH:" . $path, 94);
276
-        }else{
276
+        } else{
277 277
             $size = Directory::dirSize($path);
278 278
         }
279 279
 
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Sqlite/Driver.php 1 patch
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -16,13 +16,11 @@
 block discarded – undo
16 16
 
17 17
 use PDO;
18 18
 use PDOException;
19
-use phpFastCache\Core\Item\ExtendedCacheItemInterface;
20 19
 use phpFastCache\Core\Pool\DriverBaseTrait;
21 20
 use phpFastCache\Core\Pool\ExtendedCacheItemPoolInterface;
22 21
 use phpFastCache\Core\Pool\IO\IOHelperTrait;
23 22
 use phpFastCache\Entities\driverStatistic;
24 23
 use phpFastCache\Exceptions\phpFastCacheDriverCheckException;
25
-use phpFastCache\Exceptions\phpFastCacheDriverException;
26 24
 use phpFastCache\Exceptions\phpFastCacheIOException;
27 25
 use phpFastCache\Util\Directory;
28 26
 use Psr\Cache\CacheItemInterface;
Please login to merge, or discard this patch.