Completed
Push — v5 ( 7c207e...7bca9d )
by Georges
02:37
created
src/autoload.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@
 block discarded – undo
17 17
 /**
18 18
  * Register Autoload
19 19
  */
20
-spl_autoload_register(function ($entity) {
20
+spl_autoload_register(function($entity) {
21 21
     $module = explode('\\', $entity, 2);
22
-    if (!in_array($module[ 0 ], ['phpFastCache', 'Psr'])) {
22
+    if (!in_array($module[0], ['phpFastCache', 'Psr'])) {
23 23
         /**
24 24
          * Not a part of phpFastCache file
25 25
          * then we return here.
Please login to merge, or discard this patch.
src/phpFastCache/Core/StandardPsr6StructureTrait.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             throw new \InvalidArgumentException(sprintf('$key must be a string, got type "%s" instead.', gettype($key)));
72 72
         }
73 73
 
74
-        return $this->itemInstances[ $key ];
74
+        return $this->itemInstances[$key];
75 75
     }
76 76
 
77 77
     /**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     public function setItem(CacheItemInterface $item)
83 83
     {
84 84
         if ($this->getClassNamespace() . '\\Item' === get_class($item)) {
85
-            $this->itemInstances[ $item->getKey() ] = $item;
85
+            $this->itemInstances[$item->getKey()] = $item;
86 86
 
87 87
             return $this;
88 88
         } else {
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     {
100 100
         $collection = [];
101 101
         foreach ($keys as $key) {
102
-            $collection[ $key ] = $this->getItem($key);
102
+            $collection[$key] = $this->getItem($key);
103 103
         }
104 104
 
105 105
         return $collection;
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function saveDeferred(CacheItemInterface $item)
173 173
     {
174
-        return $this->deferredList[ $item->getKey() ] = $item;
174
+        return $this->deferredList[$item->getKey()] = $item;
175 175
     }
176 176
 
177 177
     /**
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
         foreach ($this->deferredList as $key => $item) {
185 185
             $result = $this->save($item);
186 186
             if ($return !== false) {
187
-                unset($this->deferredList[ $key ]);
187
+                unset($this->deferredList[$key]);
188 188
                 $return = $result;
189 189
             }
190 190
         }
Please login to merge, or discard this patch.
src/phpFastCache/Core/PathSeekerTrait.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -29,27 +29,27 @@  discard block
 block discarded – undo
29 29
     {
30 30
         $tmp_dir = ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir();
31 31
 
32
-        if (!isset($this->config[ 'path' ]) || $this->config[ 'path' ] == '') {
32
+        if (!isset($this->config['path']) || $this->config['path'] == '') {
33 33
             if (self::isPHPModule()) {
34 34
                 $path = $tmp_dir;
35 35
             } else {
36
-                $document_root_path = rtrim($_SERVER[ 'DOCUMENT_ROOT' ], '/') . '/../';
37
-                $path = isset($_SERVER[ 'DOCUMENT_ROOT' ]) && is_writable($document_root_path) ? $document_root_path : rtrim(__DIR__, '/') . '/';
36
+                $document_root_path = rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/../';
37
+                $path = isset($_SERVER['DOCUMENT_ROOT']) && is_writable($document_root_path) ? $document_root_path : rtrim(__DIR__, '/') . '/';
38 38
             }
39 39
 
40
-            if ($this->config[ 'path' ] != '') {
41
-                $path = $this->config[ 'path' ];
40
+            if ($this->config['path'] != '') {
41
+                $path = $this->config['path'];
42 42
             }
43 43
 
44 44
         } else {
45
-            $path = $this->config[ 'path' ];
45
+            $path = $this->config['path'];
46 46
         }
47 47
 
48
-        $securityKey = array_key_exists('securityKey', $this->config) ? $this->config[ 'securityKey' ] : '';
48
+        $securityKey = array_key_exists('securityKey', $this->config) ? $this->config['securityKey'] : '';
49 49
         if ($securityKey == "" || $securityKey == 'auto') {
50
-            $securityKey = $this->config[ 'securityKey' ];
50
+            $securityKey = $this->config['securityKey'];
51 51
             if ($securityKey == 'auto' || $securityKey == '') {
52
-                $securityKey = isset($_SERVER[ 'HTTP_HOST' ]) ? preg_replace('/^www./', '', strtolower($_SERVER[ 'HTTP_HOST' ])) : "default";
52
+                $securityKey = isset($_SERVER['HTTP_HOST']) ? preg_replace('/^www./', '', strtolower($_SERVER['HTTP_HOST'])) : "default";
53 53
             }
54 54
         }
55 55
         if ($securityKey != '') {
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $full_pathx = md5($full_path);
63 63
 
64 64
 
65
-        if (!isset($this->tmp[ $full_pathx ])) {
65
+        if (!isset($this->tmp[$full_pathx])) {
66 66
 
67 67
             if (!@file_exists($full_path) || !@is_writable($full_path)) {
68 68
                 if (!@file_exists($full_path)) {
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
                 }
87 87
             }
88 88
 
89
-            $this->tmp[ $full_pathx ] = true;
90
-            $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config[ 'htaccess' ] : false);
89
+            $this->tmp[$full_pathx] = true;
90
+            $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config['htaccess'] : false);
91 91
         }
92 92
 
93 93
         return realpath($full_path);
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
      */
147 147
     public function setChmodAuto()
148 148
     {
149
-        if (!isset($this->config[ 'default_chmod' ]) || $this->config[ 'default_chmod' ] == '' || is_null($this->config[ 'default_chmod' ])) {
149
+        if (!isset($this->config['default_chmod']) || $this->config['default_chmod'] == '' || is_null($this->config['default_chmod'])) {
150 150
             return 0777;
151 151
         } else {
152
-            return $this->config[ 'default_chmod' ];
152
+            return $this->config['default_chmod'];
153 153
         }
154 154
     }
155 155
 
Please login to merge, or discard this patch.
src/phpFastCache/Cache/ItemBaseTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
     public function removeTag($tagName)
350 350
     {
351 351
         if (($key = array_search($tagName, $this->tags)) !== false) {
352
-            unset($this->tags[ $key ]);
352
+            unset($this->tags[$key]);
353 353
             $this->removedTags[] = $tagName;
354 354
         }
355 355
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
     final public function __debugInfo()
393 393
     {
394 394
         $info = get_object_vars($this);
395
-        $info[ 'driver' ] = 'object(' . get_class($info[ 'driver' ]) . ')';
395
+        $info['driver'] = 'object(' . get_class($info['driver']) . ')';
396 396
 
397 397
         return (array) $info;
398 398
     }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Files/Driver.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             /*
72 72
              * Skip if Existing Caching in Options
73 73
              */
74
-            if (isset($option[ 'skipExisting' ]) && $option[ 'skipExisting' ] == true && file_exists($file_path)) {
74
+            if (isset($option['skipExisting']) && $option['skipExisting'] == true && file_exists($file_path)) {
75 75
                 $content = $this->readfile($file_path);
76 76
                 $old = $this->decode($content);
77 77
                 $toWrite = false;
@@ -250,11 +250,11 @@  discard block
 block discarded – undo
250 250
                         } else {
251 251
                             //Because PHP 5.3, this cannot be written in single line
252 252
                             $key = explode('.', $f);
253
-                            $key = $key[ 0 ];
253
+                            $key = $key[0];
254 254
                         }
255
-                        $content[ $key ] = [
255
+                        $content[$key] = [
256 256
                           'size' => $size,
257
-                          'write_time' => (isset($object[ 'write_time' ]) ? $object[ 'write_time' ] : null),
257
+                          'write_time' => (isset($object['write_time']) ? $object['write_time'] : null),
258 258
                         ];
259 259
                         if ($object->isExpired()) {
260 260
                             @unlink($file_path);
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Predis/Driver.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      */
127 127
     public function driverConnect()
128 128
     {
129
-        $server = isset($this->config[ 'redis' ]) ? $this->config[ 'redis' ] : [
129
+        $server = isset($this->config['redis']) ? $this->config['redis'] : [
130 130
           'host' => '127.0.0.1',
131 131
           'port' => '6379',
132 132
           'password' => '',
@@ -134,32 +134,32 @@  discard block
 block discarded – undo
134 134
         ];
135 135
 
136 136
         $config = [
137
-          'host' => $server[ 'host' ],
137
+          'host' => $server['host'],
138 138
         ];
139 139
 
140
-        $port = isset($server[ 'port' ]) ? $server[ 'port' ] : '';
140
+        $port = isset($server['port']) ? $server['port'] : '';
141 141
         if ($port != '') {
142
-            $config[ 'port' ] = $port;
142
+            $config['port'] = $port;
143 143
         }
144 144
 
145
-        $password = isset($server[ 'password' ]) ? $server[ 'password' ] : '';
145
+        $password = isset($server['password']) ? $server['password'] : '';
146 146
         if ($password != '') {
147
-            $config[ 'password' ] = $password;
147
+            $config['password'] = $password;
148 148
         }
149 149
 
150
-        $database = isset($server[ 'database' ]) ? $server[ 'database' ] : '';
150
+        $database = isset($server['database']) ? $server['database'] : '';
151 151
         if ($database != '') {
152
-            $config[ 'database' ] = $database;
152
+            $config['database'] = $database;
153 153
         }
154 154
 
155
-        $timeout = isset($server[ 'timeout' ]) ? $server[ 'timeout' ] : '';
155
+        $timeout = isset($server['timeout']) ? $server['timeout'] : '';
156 156
         if ($timeout != '') {
157
-            $config[ 'timeout' ] = $timeout;
157
+            $config['timeout'] = $timeout;
158 158
         }
159 159
 
160
-        $read_write_timeout = isset($server[ 'read_write_timeout' ]) ? $server[ 'read_write_timeout' ] : '';
160
+        $read_write_timeout = isset($server['read_write_timeout']) ? $server['read_write_timeout'] : '';
161 161
         if ($read_write_timeout != '') {
162
-            $config[ 'read_write_timeout' ] = $read_write_timeout;
162
+            $config['read_write_timeout'] = $read_write_timeout;
163 163
         }
164 164
 
165 165
         $this->instance = new PredisClient($config);
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Mongodb/Driver.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
                 return false;
92 92
             }
93 93
 
94
-            return isset($result[ 'ok' ]) ? $result[ 'ok' ] == 1 : true;
94
+            return isset($result['ok']) ? $result['ok'] == 1 : true;
95 95
         } else {
96 96
             throw new \InvalidArgumentException('Cross-Driver type confusion detected');
97 97
         }
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
         $document = $this->getCollection()->findOne(['_id' => $key], [self::DRIVER_DATA_WRAPPER_INDEX, self::DRIVER_TIME_WRAPPER_INDEX  /*'d', 'e'*/]);
107 107
         if ($document) {
108 108
             return [
109
-              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin),
110
-              self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec),
109
+              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[self::DRIVER_DATA_WRAPPER_INDEX]->bin),
110
+              self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_TIME_WRAPPER_INDEX]->sec),
111 111
             ];
112 112
         } else {
113 113
             return null;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         if ($item instanceof Item) {
128 128
             $deletionResult = (array) $this->getCollection()->remove(['_id' => $item->getKey()], ["w" => 1]);
129 129
 
130
-            return (int) $deletionResult[ 'ok' ] === 1 && !$deletionResult[ 'err' ];
130
+            return (int) $deletionResult['ok'] === 1 && !$deletionResult['err'];
131 131
         } else {
132 132
             throw new \InvalidArgumentException('Cross-Driver type confusion detected');
133 133
         }
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
         if ($this->instance instanceof MongodbClient) {
152 152
             throw new LogicException('Already connected to Mongodb server');
153 153
         } else {
154
-            $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1';
155
-            $port = isset($server[ 'port' ]) ? $server[ 'port' ] : '27017';
156
-            $timeout = isset($server[ 'timeout' ]) ? $server[ 'timeout' ] : 3;
157
-            $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
158
-            $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
154
+            $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1';
155
+            $port = isset($server['port']) ? $server['port'] : '27017';
156
+            $timeout = isset($server['timeout']) ? $server['timeout'] : 3;
157
+            $password = isset($this->config['password']) ? $this->config['password'] : '';
158
+            $username = isset($this->config['username']) ? $this->config['username'] : '';
159 159
 
160 160
 
161 161
             /**
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
     {
189 189
         $document = $this->getCollection()->findOne(['_id' => $item->getKey()], [self::DRIVER_TIME_WRAPPER_INDEX  /*'d', 'e'*/]);
190 190
         if ($document) {
191
-            return $document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec >= time();
191
+            return $document[self::DRIVER_TIME_WRAPPER_INDEX]->sec >= time();
192 192
         } else {
193 193
             return null;
194 194
         }
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
         ]);
218 218
 
219 219
         $stats = (new driverStatistic())
220
-          ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1))
221
-          ->setSize((int) $collStats[ 'size' ])
220
+          ->setInfo('MongoDB version ' . $serverStatus['version'] . ', Uptime (in days): ' . round($serverStatus['uptime'] / 86400, 1))
221
+          ->setSize((int) $collStats['size'])
222 222
           ->setRawData([
223 223
             'serverStatus' => $serverStatus,
224 224
             'collStats' => $collStats,
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Memcache/Driver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             $this->instance = new MemcacheSoftware();
53 53
             $this->driverConnect();
54 54
 
55
-            if (array_key_exists('compress_data', $config) && $config[ 'compress_data' ] === true) {
55
+            if (array_key_exists('compress_data', $config) && $config['compress_data'] === true) {
56 56
                 $this->memcacheFlags = MEMCACHE_COMPRESSED;
57 57
             }
58 58
         }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function driverConnect()
132 132
     {
133
-        $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []);
133
+        $servers = (!empty($this->config['memcache']) && is_array($this->config['memcache']) ? $this->config['memcache'] : []);
134 134
         if (count($servers) < 1) {
135 135
             $servers = [
136 136
               ['127.0.0.1', 11211],
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
         foreach ($servers as $server) {
141 141
             try {
142
-                if (!$this->instance->addserver($server[ 0 ], $server[ 1 ])) {
142
+                if (!$this->instance->addserver($server[0], $server[1])) {
143 143
                     $this->fallback = true;
144 144
                 }
145 145
             } catch (\Exception $e) {
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Ssdb/Driver.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -143,17 +143,17 @@
 block discarded – undo
143 143
      */
144 144
     public function driverConnect()
145 145
     {
146
-        $server = isset($this->config[ 'ssdb' ]) ? $this->config[ 'ssdb' ] : [
146
+        $server = isset($this->config['ssdb']) ? $this->config['ssdb'] : [
147 147
           'host' => "127.0.0.1",
148 148
           'port' => 8888,
149 149
           'password' => '',
150 150
           'timeout' => 2000,
151 151
         ];
152 152
 
153
-        $host = $server[ 'host' ];
154
-        $port = isset($server[ 'port' ]) ? (int) $server[ 'port' ] : 8888;
155
-        $password = isset($server[ 'password' ]) ? $server[ 'password' ] : '';
156
-        $timeout = !empty($server[ 'timeout' ]) ? (int) $server[ 'timeout' ] : 2000;
153
+        $host = $server['host'];
154
+        $port = isset($server['port']) ? (int) $server['port'] : 8888;
155
+        $password = isset($server['password']) ? $server['password'] : '';
156
+        $timeout = !empty($server['timeout']) ? (int) $server['timeout'] : 2000;
157 157
         $this->instance = new SimpleSSDB($host, $port, $timeout);
158 158
         if (!empty($password)) {
159 159
             $this->instance->auth($password);
Please login to merge, or discard this patch.