Completed
Push — V6 ( 2dc313...bda464 )
by Georges
02:14
created
src/phpFastCache/Drivers/Mongodb/Driver.php 3 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -83,15 +83,15 @@  discard block
 block discarded – undo
83 83
         if ($item instanceof Item) {
84 84
             try {
85 85
                 $result = (array) $this->getCollection()->update(
86
-                  ['_id' => $item->getKey()],
87
-                  [
86
+                    ['_id' => $item->getKey()],
87
+                    [
88 88
                     '$set' => [
89
-                      self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new MongoDate(time() + $item->getTtl()) : new MongoDate(time())),
90
-                      self::DRIVER_DATA_WRAPPER_INDEX => new MongoBinData($this->encode($item->get()), MongoBinData::BYTE_ARRAY),
91
-                      self::DRIVER_TAGS_WRAPPER_INDEX => new MongoBinData($this->encode($item->getTags()), MongoBinData::BYTE_ARRAY),
89
+                        self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new MongoDate(time() + $item->getTtl()) : new MongoDate(time())),
90
+                        self::DRIVER_DATA_WRAPPER_INDEX => new MongoBinData($this->encode($item->get()), MongoBinData::BYTE_ARRAY),
91
+                        self::DRIVER_TAGS_WRAPPER_INDEX => new MongoBinData($this->encode($item->getTags()), MongoBinData::BYTE_ARRAY),
92 92
                     ],
93
-                  ],
94
-                  ['upsert' => true, 'multiple' => false]
93
+                    ],
94
+                    ['upsert' => true, 'multiple' => false]
95 95
                 );
96 96
             } catch (MongoCursorException $e) {
97 97
                 return false;
@@ -110,14 +110,14 @@  discard block
 block discarded – undo
110 110
     protected function driverRead(CacheItemInterface $item)
111 111
     {
112 112
         $document = $this->getCollection()
113
-          ->findOne(['_id' => $item->getKey()],
113
+            ->findOne(['_id' => $item->getKey()],
114 114
             [self::DRIVER_DATA_WRAPPER_INDEX, self::DRIVER_EDATE_WRAPPER_INDEX, self::DRIVER_TAGS_WRAPPER_INDEX  /*'d', 'e'*/]);
115 115
 
116 116
         if ($document) {
117 117
             return [
118
-              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin),
119
-              self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->sec),
120
-              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin),
118
+                self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin),
119
+                self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->sec),
120
+                self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin),
121 121
             ];
122 122
         } else {
123 123
             return null;
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
              * @todo make an url builder
173 173
              */
174 174
             $this->instance = $this->instance ?: (new MongodbClient('mongodb://' .
175
-              ($username ?: '') .
176
-              ($password ? ":{$password}" : '') .
177
-              ($username ? '@' : '') . "{$host}" .
178
-              ($port != '27017' ? ":{$port}" : ''), ['connectTimeoutMS' => $timeout * 1000]))->phpFastCache;
175
+                ($username ?: '') .
176
+                ($password ? ":{$password}" : '') .
177
+                ($username ? '@' : '') . "{$host}" .
178
+                ($port != '27017' ? ":{$port}" : ''), ['connectTimeoutMS' => $timeout * 1000]))->phpFastCache;
179 179
             // $this->instance->Cache->createIndex([self::DRIVER_TIME_WRAPPER_INDEX => 1], ['expireAfterSeconds' => 0]);
180 180
         }
181 181
     }
@@ -201,25 +201,25 @@  discard block
 block discarded – undo
201 201
     public function getStats()
202 202
     {
203 203
         $serverStatus = $this->getCollection()->db->command([
204
-          'serverStatus' => 1,
205
-          'recordStats' => 0,
206
-          'repl' => 0,
207
-          'metrics' => 0,
204
+            'serverStatus' => 1,
205
+            'recordStats' => 0,
206
+            'repl' => 0,
207
+            'metrics' => 0,
208 208
         ]);
209 209
 
210 210
         $collStats = $this->getCollection()->db->command([
211
-          'collStats' => 'Cache',
212
-          'verbose' => true,
211
+            'collStats' => 'Cache',
212
+            'verbose' => true,
213 213
         ]);
214 214
 
215 215
         $stats = (new driverStatistic())
216
-          ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.")
217
-          ->setSize((int) @$collStats[ 'size' ])
218
-          ->setData(implode(', ', array_keys($this->itemInstances)))
219
-          ->setRawData([
216
+            ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.")
217
+            ->setSize((int) @$collStats[ 'size' ])
218
+            ->setData(implode(', ', array_keys($this->itemInstances)))
219
+            ->setRawData([
220 220
             'serverStatus' => $serverStatus,
221 221
             'collStats' => $collStats,
222
-          ]);
222
+            ]);
223 223
 
224 224
         return $stats;
225 225
     }
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
     /**
74 74
      * @param \Psr\Cache\CacheItemInterface $item
75
-     * @return mixed
75
+     * @return boolean
76 76
      * @throws phpFastCacheInvalidArgumentException
77 77
      */
78 78
     protected function driverWrite(CacheItemInterface $item)
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
     }
153 153
 
154 154
     /**
155
-     * @return bool
155
+     * @return boolean|null
156 156
      * @throws MongoConnectionException
157 157
      * @throws LogicException
158 158
      */
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function driverCheck()
64 64
     {
65
-        if(class_exists('MongoDB\Driver\Manager')){
65
+        if (class_exists('MongoDB\Driver\Manager')) {
66 66
             trigger_error('PhpFastCache currently only support the pecl Mongo extension.<br />
67 67
             The Support for the MongoDB extension will be added coming soon.', E_USER_ERROR);
68 68
         }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
                 return false;
98 98
             }
99 99
 
100
-            return isset($result[ 'ok' ]) ? $result[ 'ok' ] == 1 : true;
100
+            return isset($result['ok']) ? $result['ok'] == 1 : true;
101 101
         } else {
102 102
             throw new phpFastCacheInvalidArgumentException('Cross-Driver type confusion detected');
103 103
         }
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 
116 116
         if ($document) {
117 117
             return [
118
-              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin),
119
-              self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->sec),
120
-              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin),
118
+              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[self::DRIVER_DATA_WRAPPER_INDEX]->bin),
119
+              self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_EDATE_WRAPPER_INDEX]->sec),
120
+              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[self::DRIVER_TAGS_WRAPPER_INDEX]->bin),
121 121
             ];
122 122
         } else {
123 123
             return null;
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         if ($item instanceof Item) {
138 138
             $deletionResult = (array) $this->getCollection()->remove(['_id' => $item->getKey()], ["w" => 1]);
139 139
 
140
-            return (int) $deletionResult[ 'ok' ] === 1 && !$deletionResult[ 'err' ];
140
+            return (int) $deletionResult['ok'] === 1 && !$deletionResult['err'];
141 141
         } else {
142 142
             throw new phpFastCacheInvalidArgumentException('Cross-Driver type confusion detected');
143 143
         }
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
         if ($this->instance instanceof MongodbClient) {
162 162
             throw new LogicException('Already connected to Mongodb server');
163 163
         } else {
164
-            $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1';
165
-            $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : '27017';
166
-            $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : 3;
167
-            $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
168
-            $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
164
+            $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1';
165
+            $port = isset($this->config['port']) ? $this->config['port'] : '27017';
166
+            $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 3;
167
+            $password = isset($this->config['password']) ? $this->config['password'] : '';
168
+            $username = isset($this->config['username']) ? $this->config['username'] : '';
169 169
 
170 170
 
171 171
             /**
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
         ]);
226 226
 
227 227
         $stats = (new driverStatistic())
228
-          ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.")
229
-          ->setSize((int) @$collStats[ 'size' ])
228
+          ->setInfo('MongoDB version ' . $serverStatus['version'] . ', Uptime (in days): ' . round($serverStatus['uptime'] / 86400, 1) . "\n For more information see RawData.")
229
+          ->setSize((int) @$collStats['size'])
230 230
           ->setData(implode(', ', array_keys($this->itemInstances)))
231 231
           ->setRawData([
232 232
             'serverStatus' => $serverStatus,
Please login to merge, or discard this patch.
src/phpFastCache/Core/Pool/DriverBaseTrait.php 3 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.
Spacing   +16 added lines, -16 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
 
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function getConfigOption($optionName)
72 72
     {
73
-        if(isset($this->config[$optionName])){
73
+        if (isset($this->config[$optionName])) {
74 74
             return $this->config[$optionName];
75
-        }else{
75
+        } else {
76 76
             return null;
77 77
         }
78 78
     }
@@ -142,16 +142,16 @@  discard block
 block discarded – undo
142 142
           self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(),
143 143
         ];
144 144
 
145
-        if($this->config['itemDetailedDate']){
146
-            $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = new \DateTime();
145
+        if ($this->config['itemDetailedDate']) {
146
+            $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = new \DateTime();
147 147
             /**
148 148
              * If the creation date exists
149 149
              * reuse it else set a new Date
150 150
              */
151
-            $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = $item->getCreationDate() ?: new \DateTime();
152
-        }else{
153
-            $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = null;
154
-            $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = null;
151
+            $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = $item->getCreationDate() ?: new \DateTime();
152
+        } else {
153
+            $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = null;
154
+            $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = null;
155 155
         }
156 156
 
157 157
         return $wrap;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
      */
164 164
     public function driverUnwrapData(array $wrapper)
165 165
     {
166
-        return $wrapper[ self::DRIVER_DATA_WRAPPER_INDEX ];
166
+        return $wrapper[self::DRIVER_DATA_WRAPPER_INDEX];
167 167
     }
168 168
 
169 169
     /**
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      */
173 173
     public function driverUnwrapTags(array $wrapper)
174 174
     {
175
-        return $wrapper[ self::DRIVER_TAGS_WRAPPER_INDEX ];
175
+        return $wrapper[self::DRIVER_TAGS_WRAPPER_INDEX];
176 176
     }
177 177
 
178 178
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      */
183 183
     public function driverUnwrapEdate(array $wrapper)
184 184
     {
185
-        return $wrapper[ self::DRIVER_EDATE_WRAPPER_INDEX ];
185
+        return $wrapper[self::DRIVER_EDATE_WRAPPER_INDEX];
186 186
     }
187 187
 
188 188
     /**
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      */
192 192
     public function driverUnwrapCdate(array $wrapper)
193 193
     {
194
-        return $wrapper[ self::DRIVER_CDATE_WRAPPER_INDEX ];
194
+        return $wrapper[self::DRIVER_CDATE_WRAPPER_INDEX];
195 195
     }
196 196
 
197 197
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
      */
202 202
     public function driverUnwrapMdate(array $wrapper)
203 203
     {
204
-        return $wrapper[ self::DRIVER_MDATE_WRAPPER_INDEX ];
204
+        return $wrapper[self::DRIVER_MDATE_WRAPPER_INDEX];
205 205
     }
206 206
 
207 207
     /**
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
          * on tags item, it can leads
227 227
          * to an infinite recursive calls
228 228
          */
229
-        if(strpos($item->getKey(), self::DRIVER_TAGS_KEY_PREFIX ) === 0){
229
+        if (strpos($item->getKey(), self::DRIVER_TAGS_KEY_PREFIX) === 0) {
230 230
             throw new \LogicException('Trying to set tag(s) to an Tag item index: ' . $item->getKey());
231 231
         }
232 232
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
         foreach ($tagsItems as $tagsItem) {
270 270
             $data = (array) $tagsItem->get();
271 271
 
272
-            unset($data[ $item->getKey() ]);
272
+            unset($data[$item->getKey()]);
273 273
             $tagsItem->set($data);
274 274
 
275 275
             /**
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     {
73 73
         if(isset($this->config[$optionName])){
74 74
             return $this->config[$optionName];
75
-        }else{
75
+        } else{
76 76
             return null;
77 77
         }
78 78
     }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
              * reuse it else set a new Date
150 150
              */
151 151
             $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = $item->getCreationDate() ?: new \DateTime();
152
-        }else{
152
+        } else{
153 153
             $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = null;
154 154
             $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = null;
155 155
         }
Please login to merge, or discard this patch.
src/phpFastCache/Util/MemcacheDriverCollisionDetectorTrait.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
                 return true;
28 28
             } else if (constant($CONSTANT_NAME) !== $driverName) {
29 29
                 trigger_error('Memcache collision detected, you used both Memcache and Memcached driver in your script, this may leads to unexpected behaviours',
30
-                  E_USER_WARNING);
30
+                    E_USER_WARNING);
31 31
 
32 32
                 return false;
33 33
             }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Sqlite/Driver.php 3 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
             $stm = $this->indexing->prepare("SELECT MAX(`db`) as `db` FROM `balancing`");
163 163
             $stm->execute();
164 164
             $row = $stm->fetch(PDO::FETCH_ASSOC);
165
-            if (!isset($row[ 'db' ])) {
165
+            if (!isset($row['db'])) {
166 166
                 $db = 1;
167
-            } elseif ($row[ 'db' ] <= 1) {
167
+            } elseif ($row['db'] <= 1) {
168 168
                 $db = 1;
169 169
             } else {
170
-                $db = $row[ 'db' ];
170
+                $db = $row['db'];
171 171
             }
172 172
 
173 173
             // check file size
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
           ':keyword' => $keyword,
190 190
         ]);
191 191
         $row = $stm->fetch(PDO::FETCH_ASSOC);
192
-        if (isset($row[ 'db' ]) && $row[ 'db' ] != '') {
193
-            $db = $row[ 'db' ];
192
+        if (isset($row['db']) && $row['db'] != '') {
193
+            $db = $row['db'];
194 194
         } else {
195 195
             /*
196 196
              * Insert new to Indexing
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         /**
222 222
          * init instant
223 223
          */
224
-        if (!isset($this->instance[ $instant ])) {
224
+        if (!isset($this->instance[$instant])) {
225 225
             // check DB Files ready or not
226 226
             $createTable = false;
227 227
             if (!file_exists($this->SqliteDir . '/db' . $instant) || $reset == true) {
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
                 $this->initDB($PDO);
235 235
             }
236 236
 
237
-            $this->instance[ $instant ] = $PDO;
237
+            $this->instance[$instant] = $PDO;
238 238
             unset($PDO);
239 239
 
240 240
         }
241 241
 
242
-        return $this->instance[ $instant ];
242
+        return $this->instance[$instant];
243 243
     }
244 244
 
245 245
     /**
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
          * Check for Cross-Driver type confusion
254 254
          */
255 255
         if ($item instanceof Item) {
256
-            $skipExisting = isset($this->config[ 'skipExisting' ]) ? $this->config[ 'skipExisting' ] : false;
256
+            $skipExisting = isset($this->config['skipExisting']) ? $this->config['skipExisting'] : false;
257 257
             $toWrite = true;
258 258
 
259 259
             // check in cache first
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
             }
330 330
         }
331 331
 
332
-        if (isset($row[ 'object' ])) {
333
-            return $this->decode($row[ 'object' ]);
332
+        if (isset($row['object'])) {
333
+            return $this->decode($row['object']);
334 334
         }
335 335
 
336 336
         return null;
Please login to merge, or discard this patch.
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
             $PDO = new PDO("sqlite:" . $this->SqliteDir . '/' . self::INDEXING_FILE);
155 155
             $PDO->setAttribute(PDO::ATTR_ERRMODE,
156
-              PDO::ERRMODE_EXCEPTION);
156
+                PDO::ERRMODE_EXCEPTION);
157 157
 
158 158
             if ($createTable == true) {
159 159
                 $this->initIndexing($PDO);
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         // look for keyword
189 189
         $stm = $this->indexing->prepare("SELECT * FROM `balancing` WHERE `keyword`=:keyword LIMIT 1");
190 190
         $stm->execute([
191
-          ':keyword' => $keyword,
191
+            ':keyword' => $keyword,
192 192
         ]);
193 193
         $row = $stm->fetch(PDO::FETCH_ASSOC);
194 194
         if (isset($row[ 'db' ]) && $row[ 'db' ] != '') {
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
             $db = $this->currentDB;
201 201
             $stm = $this->indexing->prepare("INSERT INTO `balancing` (`keyword`,`db`) VALUES(:keyword, :db)");
202 202
             $stm->execute([
203
-              ':keyword' => $keyword,
204
-              ':db' => $db,
203
+                ':keyword' => $keyword,
204
+                ':db' => $db,
205 205
             ]);
206 206
         }
207 207
 
@@ -272,11 +272,11 @@  discard block
 block discarded – undo
272 272
             if ($toWrite == true) {
273 273
                 try {
274 274
                     $stm = $this->getDb($item->getKey())
275
-                      ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)");
275
+                        ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)");
276 276
                     $stm->execute([
277
-                      ':keyword' => $item->getKey(),
278
-                      ':object' => $this->encode($this->driverPreWrap($item)),
279
-                      ':exp' => time() + $item->getTtl(),
277
+                        ':keyword' => $item->getKey(),
278
+                        ':object' => $this->encode($this->driverPreWrap($item)),
279
+                        ':exp' => time() + $item->getTtl(),
280 280
                     ]);
281 281
 
282 282
                     return true;
@@ -284,11 +284,11 @@  discard block
 block discarded – undo
284 284
 
285 285
                     try {
286 286
                         $stm = $this->getDb($item->getKey(), true)
287
-                          ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)");
287
+                            ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)");
288 288
                         $stm->execute([
289
-                          ':keyword' => $item->getKey(),
290
-                          ':object' => $this->encode($this->driverPreWrap($item)),
291
-                          ':exp' => time() + $item->getTtl(),
289
+                            ':keyword' => $item->getKey(),
290
+                            ':object' => $this->encode($this->driverPreWrap($item)),
291
+                            ':exp' => time() + $item->getTtl(),
292 292
                         ]);
293 293
                     } catch (PDOException $e) {
294 294
                         return false;
@@ -310,20 +310,20 @@  discard block
 block discarded – undo
310 310
     {
311 311
         try {
312 312
             $stm = $this->getDb($item->getKey())
313
-              ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U)  LIMIT 1");
313
+                ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U)  LIMIT 1");
314 314
             $stm->execute([
315
-              ':keyword' => $item->getKey(),
316
-              ':U' => time(),
315
+                ':keyword' => $item->getKey(),
316
+                ':U' => time(),
317 317
             ]);
318 318
             $row = $stm->fetch(PDO::FETCH_ASSOC);
319 319
 
320 320
         } catch (PDOException $e) {
321 321
             try {
322 322
                 $stm = $this->getDb($item->getKey(), true)
323
-                  ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U)  LIMIT 1");
323
+                    ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U)  LIMIT 1");
324 324
                 $stm->execute([
325
-                  ':keyword' => $item->getKey(),
326
-                  ':U' => time(),
325
+                    ':keyword' => $item->getKey(),
326
+                    ':U' => time(),
327 327
                 ]);
328 328
                 $row = $stm->fetch(PDO::FETCH_ASSOC);
329 329
             } catch (PDOException $e) {
@@ -351,13 +351,13 @@  discard block
 block discarded – undo
351 351
         if ($item instanceof Item) {
352 352
             try {
353 353
                 $stm = $this->getDb($item->getKey())
354
-                  //->prepare("DELETE FROM `caching` WHERE (`id`=:id) OR (`exp` <= :U) ");
355
-                  ->prepare("DELETE FROM `caching` WHERE (`exp` <= :U) OR (`keyword`=:keyword) ");
354
+                    //->prepare("DELETE FROM `caching` WHERE (`id`=:id) OR (`exp` <= :U) ");
355
+                    ->prepare("DELETE FROM `caching` WHERE (`exp` <= :U) OR (`keyword`=:keyword) ");
356 356
 
357 357
                 return $stm->execute([
358 358
                     // ':id' => $row[ 'id' ],
359
-                  ':keyword' => $item->getKey(),
360
-                  ':U' => time(),
359
+                    ':keyword' => $item->getKey(),
360
+                    ':U' => time(),
361 361
                 ]);
362 362
             } catch (PDOException $e) {
363 363
                 return false;
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     }
207 207
 
208 208
     /**
209
-     * @param $keyword
209
+     * @param string $keyword
210 210
      * @param bool $reset
211 211
      * @return PDO
212 212
      */
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 
244 244
     /**
245 245
      * @param \Psr\Cache\CacheItemInterface $item
246
-     * @return mixed
246
+     * @return boolean
247 247
      * @throws phpFastCacheInvalidArgumentException
248 248
      */
249 249
     protected function driverWrite(CacheItemInterface $item)
Please login to merge, or discard this patch.
src/phpFastCache/Entities/driverStatistic.php 1 patch
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     }
53 53
 
54 54
     /**
55
-     * @return int|bool Return size in octet or false if no information available
55
+     * @return string Return size in octet or false if no information available
56 56
      */
57 57
     public function getSize()
58 58
     {
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     }
61 61
 
62 62
     /**
63
-     * @return mixed
63
+     * @return string
64 64
      */
65 65
     public function getData()
66 66
     {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     }
69 69
 
70 70
     /**
71
-     * @param $info
71
+     * @param string $info
72 72
      * @return $this
73 73
      */
74 74
     public function setInfo($info)
Please login to merge, or discard this patch.
src/phpFastCache/Core/Pool/CacheItemPoolTrait.php 3 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
                     } else {
86 86
                         $item->setHit(true);
87 87
                     }
88
-                }else{
88
+                } else{
89 89
                     $item->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ]));
90 90
                 }
91 91
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     {
230 230
         if (!array_key_exists($item->getKey(), $this->itemInstances)) {
231 231
             $this->itemInstances[ $item->getKey() ] = $item;
232
-        }else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
232
+        } else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
233 233
             throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
234 234
         }
235 235
 
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     public function getItem($key)
62 62
     {
63 63
         if (is_string($key)) {
64
-            if (preg_match('~([' . preg_quote(self::$unsupportedKeyChars, '~') . ']+)~', $key, $matches)){
64
+            if (preg_match('~([' . preg_quote(self::$unsupportedKeyChars, '~') . ']+)~', $key, $matches)) {
65 65
                 throw new phpFastCacheInvalidArgumentException('Unsupported key character detected: "' . $matches[1] . '". Please check: https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV6%5D-Unsupported-characters-in-key-identifiers');
66 66
             }
67 67
             if (!array_key_exists($key, $this->itemInstances)) {
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
                 $driverArray = $this->driverRead($item);
77 77
 
78 78
                 if ($driverArray) {
79
-                    if(!is_array($driverArray)){
79
+                    if (!is_array($driverArray)) {
80 80
                         throw new phpFastCacheCoreException(sprintf('The driverRead method returned an unexpected variable type: %s', gettype($driverArray)));
81 81
                     }
82 82
                     $item->set($this->driverUnwrapData($driverArray));
83 83
                     $item->expiresAt($this->driverUnwrapEdate($driverArray));
84 84
 
85
-                    if($this->config['itemDetailedDate']){
85
+                    if ($this->config['itemDetailedDate']) {
86 86
 
87 87
                         /**
88 88
                          * If the itemDetailedDate has been
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
                     } else {
107 107
                         $item->setHit(true);
108 108
                     }
109
-                }else{
110
-                    $item->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ]));
109
+                } else {
110
+                    $item->expiresAfter(abs((int) $this->getConfig()['defaultTtl']));
111 111
                 }
112 112
 
113 113
             }
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
          * @param $this ExtendedCacheItemPoolInterface
121 121
          * @param $this ExtendedCacheItemInterface
122 122
          */
123
-        $this->eventManager->dispatch('CacheGetItem', $this, $this->itemInstances[ $key ]);
123
+        $this->eventManager->dispatch('CacheGetItem', $this, $this->itemInstances[$key]);
124 124
 
125
-        return $this->itemInstances[ $key ];
125
+        return $this->itemInstances[$key];
126 126
     }
127 127
 
128 128
     /**
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
     public function setItem(CacheItemInterface $item)
134 134
     {
135 135
         if ($this->getClassNamespace() . '\\Item' === get_class($item)) {
136
-            $this->itemInstances[ $item->getKey() ] = $item;
136
+            $this->itemInstances[$item->getKey()] = $item;
137 137
 
138 138
             return $this;
139 139
         } else {
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     {
151 151
         $collection = [];
152 152
         foreach ($keys as $key) {
153
-            $collection[ $key ] = $this->getItem($key);
153
+            $collection[$key] = $this->getItem($key);
154 154
         }
155 155
 
156 156
         return $collection;
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
          * @var ExtendedCacheItemInterface $item
248 248
          */
249 249
         if (!array_key_exists($item->getKey(), $this->itemInstances)) {
250
-            $this->itemInstances[ $item->getKey() ] = $item;
251
-        } else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
250
+            $this->itemInstances[$item->getKey()] = $item;
251
+        } else if (spl_object_hash($item) !== spl_object_hash($this->itemInstances[$item->getKey()])) {
252 252
             throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
253 253
         }
254 254
 
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
     public function saveDeferred(CacheItemInterface $item)
279 279
     {
280 280
         if (!array_key_exists($item->getKey(), $this->itemInstances)) {
281
-            $this->itemInstances[ $item->getKey() ] = $item;
282
-        }else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
281
+            $this->itemInstances[$item->getKey()] = $item;
282
+        } else if (spl_object_hash($item) !== spl_object_hash($this->itemInstances[$item->getKey()])) {
283 283
             throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
284 284
         }
285 285
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
          */
291 291
         $this->eventManager->dispatch('CacheSaveDeferredItem', $this, $item);
292 292
 
293
-        return $this->deferredList[ $item->getKey() ] = $item;
293
+        return $this->deferredList[$item->getKey()] = $item;
294 294
     }
295 295
 
296 296
     /**
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
         foreach ($this->deferredList as $key => $item) {
311 311
             $result = $this->save($item);
312 312
             if ($return !== false) {
313
-                unset($this->deferredList[ $key ]);
313
+                unset($this->deferredList[$key]);
314 314
                 $return = $result;
315 315
             }
316 316
         }
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
     /**
239 239
      * @param \Psr\Cache\CacheItemInterface $item
240
-     * @return mixed
240
+     * @return boolean
241 241
      * @throws phpFastCacheInvalidArgumentException
242 242
      * @throws \RuntimeException
243 243
      */
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
     }
295 295
 
296 296
     /**
297
-     * @return mixed|null
297
+     * @return boolean
298 298
      * @throws phpFastCacheInvalidArgumentException
299 299
      */
300 300
     public function commit()
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Zendshm/Driver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -133,8 +133,8 @@
 block discarded – undo
133 133
         $stats = (array) zend_shm_cache_info();
134 134
         return (new driverStatistic())
135 135
             ->setData(implode(', ', array_keys($this->namespaces)))
136
-            ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.",$stats[ 'items_total' ]))
136
+            ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats['items_total']))
137 137
             ->setRawData($stats)
138
-            ->setSize($stats[ 'memory_total' ]);
138
+            ->setSize($stats['memory_total']);
139 139
     }
140 140
 }
141 141
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Helper/ActOnAll.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public function __construct()
23 23
     {
24
-        $this->instances =& CacheManager::getInternalInstances();
24
+        $this->instances = & CacheManager::getInternalInstances();
25 25
     }
26 26
 
27 27
     /**
@@ -29,22 +29,22 @@  discard block
 block discarded – undo
29 29
      */
30 30
     protected function getGenericCallback()
31 31
     {
32
-        return function($method, $args){
32
+        return function($method, $args) {
33 33
             $getterMethod = (strpos($method, 'get') === 0);
34 34
             $return = false;
35 35
 
36
-            if($getterMethod){
36
+            if ($getterMethod) {
37 37
                 $return = [];
38 38
             }
39 39
 
40 40
             foreach ($this->instances as $instance)
41 41
             {
42 42
                 $reflectionMethod = new \ReflectionMethod(get_class($instance), $method);
43
-                if($getterMethod){
44
-                    $return[ $instance->getDriverName() ] = $reflectionMethod->invokeArgs($instance, $args);
45
-                }else{
43
+                if ($getterMethod) {
44
+                    $return[$instance->getDriverName()] = $reflectionMethod->invokeArgs($instance, $args);
45
+                } else {
46 46
                     $result = $reflectionMethod->invokeArgs($instance, $args);
47
-                    if($result !== false){
47
+                    if ($result !== false) {
48 48
                         $return = $result;
49 49
                     }
50 50
                 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
                 $reflectionMethod = new \ReflectionMethod(get_class($instance), $method);
57 57
                 if($getterMethod){
58 58
                     $return[ $instance->getDriverName() ] = $reflectionMethod->invokeArgs($instance, $args);
59
-                }else{
59
+                } else{
60 60
                     $result = $reflectionMethod->invokeArgs($instance, $args);
61 61
                     if($result !== false){
62 62
                         $return = $result;
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Memcache/Driver.php 2 patches
Spacing   +11 added lines, -11 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
         }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      */
129 129
     protected function driverConnect()
130 130
     {
131
-        $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []);
131
+        $servers = (!empty($this->config['memcache']) && is_array($this->config['memcache']) ? $this->config['memcache'] : []);
132 132
         if (count($servers) < 1) {
133 133
             $servers = [
134 134
               ['127.0.0.1', 11211],
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
 
138 138
         foreach ($servers as $server) {
139 139
             try {
140
-                if (!$this->instance->addserver($server[ 0 ], $server[ 1 ])) {
140
+                if (!$this->instance->addserver($server[0], $server[1])) {
141 141
                     $this->fallback = true;
142 142
                 }
143
-                if(!empty($server[ 'sasl_user' ]) && !empty($server[ 'sasl_password'])){
144
-                    $this->instance->setSaslAuthData($server[ 'sasl_user' ], $server[ 'sasl_password']);
143
+                if (!empty($server['sasl_user']) && !empty($server['sasl_password'])) {
144
+                    $this->instance->setSaslAuthData($server['sasl_user'], $server['sasl_password']);
145 145
                 }
146 146
             } catch (\Exception $e) {
147 147
                 $this->fallback = true;
@@ -161,16 +161,16 @@  discard block
 block discarded – undo
161 161
     public function getStats()
162 162
     {
163 163
         $stats = (array) $this->instance->getstats();
164
-        $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0);
165
-        $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : 'UnknownVersion');
166
-        $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0);
164
+        $stats['uptime'] = (isset($stats['uptime']) ? $stats['uptime'] : 0);
165
+        $stats['version'] = (isset($stats['version']) ? $stats['version'] : 'UnknownVersion');
166
+        $stats['bytes'] = (isset($stats['bytes']) ? $stats['version'] : 0);
167 167
         
168
-        $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]);
168
+        $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']);
169 169
 
170 170
         return (new driverStatistic())
171 171
           ->setData(implode(', ', array_keys($this->itemInstances)))
172
-          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
172
+          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822)))
173 173
           ->setRawData($stats)
174
-          ->setSize($stats[ 'bytes' ]);
174
+          ->setSize($stats['bytes']);
175 175
     }
176 176
 }
177 177
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []);
131 131
         if (count($servers) < 1) {
132 132
             $servers = [
133
-              ['127.0.0.1', 11211],
133
+                ['127.0.0.1', 11211],
134 134
             ];
135 135
         }
136 136
 
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
         $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]);
161 161
 
162 162
         return (new driverStatistic())
163
-          ->setData(implode(', ', array_keys($this->itemInstances)))
164
-          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
165
-          ->setRawData($stats)
166
-          ->setSize($stats[ 'bytes' ]);
163
+            ->setData(implode(', ', array_keys($this->itemInstances)))
164
+            ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
165
+            ->setRawData($stats)
166
+            ->setSize($stats[ 'bytes' ]);
167 167
     }
168 168
 }
169 169
\ No newline at end of file
Please login to merge, or discard this patch.