Passed
Pull Request — final (#504)
by Pavel
02:30
created
src/phpFastCache/Drivers/Cassandra/Driver.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 
63 63
     /**
64 64
      * @param \Psr\Cache\CacheItemInterface $item
65
-     * @return mixed
65
+     * @return boolean
66 66
      * @throws phpFastCacheInvalidArgumentException
67 67
      */
68 68
     protected function driverWrite(CacheItemInterface $item)
Please login to merge, or discard this patch.
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -75,16 +75,16 @@  discard block
 block discarded – undo
75 75
             try {
76 76
                 $cacheData = $this->encode($this->driverPreWrap($item));
77 77
                 $options = new Cassandra\ExecutionOptions([
78
-                  'arguments' => [
78
+                    'arguments' => [
79 79
                     'cache_uuid' => new Cassandra\Uuid(),
80 80
                     'cache_id' => $item->getKey(),
81 81
                     'cache_data' => $cacheData,
82 82
                     'cache_creation_date' => new Cassandra\Timestamp((new \DateTime())->getTimestamp()),
83 83
                     'cache_expiration_date' => new Cassandra\Timestamp($item->getExpirationDate()->getTimestamp()),
84 84
                     'cache_length' => strlen($cacheData),
85
-                  ],
86
-                  'consistency' => Cassandra::CONSISTENCY_ALL,
87
-                  'serial_consistency' => Cassandra::CONSISTENCY_SERIAL,
85
+                    ],
86
+                    'consistency' => Cassandra::CONSISTENCY_ALL,
87
+                    'serial_consistency' => Cassandra::CONSISTENCY_SERIAL,
88 88
                 ]);
89 89
 
90 90
                 $query = sprintf('INSERT INTO %s.%s
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
     {
123 123
         try {
124 124
             $options = new Cassandra\ExecutionOptions([
125
-              'arguments' => ['cache_id' => $item->getKey()],
126
-              'page_size' => 1,
125
+                'arguments' => ['cache_id' => $item->getKey()],
126
+                'page_size' => 1,
127 127
             ]);
128 128
             $query = sprintf(
129
-              'SELECT cache_data FROM %s.%s WHERE cache_id = :cache_id;',
130
-              self::CASSANDRA_KEY_SPACE,
131
-              self::CASSANDRA_TABLE
129
+                'SELECT cache_data FROM %s.%s WHERE cache_id = :cache_id;',
130
+                self::CASSANDRA_KEY_SPACE,
131
+                self::CASSANDRA_TABLE
132 132
             );
133 133
             $results = $this->instance->execute(new Cassandra\SimpleStatement($query), $options);
134 134
 
@@ -155,14 +155,14 @@  discard block
 block discarded – undo
155 155
         if ($item instanceof Item) {
156 156
             try {
157 157
                 $options = new Cassandra\ExecutionOptions([
158
-                  'arguments' => [
158
+                    'arguments' => [
159 159
                     'cache_id' => $item->getKey(),
160
-                  ],
160
+                    ],
161 161
                 ]);
162 162
                 $result = $this->instance->execute(new Cassandra\SimpleStatement(sprintf(
163
-                  'DELETE FROM %s.%s WHERE cache_id = :cache_id;',
164
-                  self::CASSANDRA_KEY_SPACE,
165
-                  self::CASSANDRA_TABLE
163
+                    'DELETE FROM %s.%s WHERE cache_id = :cache_id;',
164
+                    self::CASSANDRA_KEY_SPACE,
165
+                    self::CASSANDRA_TABLE
166 166
                 )), $options);
167 167
 
168 168
                 /**
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
     {
187 187
         try {
188 188
             $this->instance->execute(new Cassandra\SimpleStatement(sprintf(
189
-              'TRUNCATE %s.%s;',
190
-              self::CASSANDRA_KEY_SPACE, self::CASSANDRA_TABLE
189
+                'TRUNCATE %s.%s;',
190
+                self::CASSANDRA_KEY_SPACE, self::CASSANDRA_TABLE
191 191
             )));
192 192
 
193 193
             return true;
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
             $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
214 214
 
215 215
             $clusterBuilder = Cassandra::cluster()
216
-              ->withContactPoints($host)
217
-              ->withPort($port);
216
+                ->withContactPoints($host)
217
+                ->withPort($port);
218 218
 
219 219
             if (!empty($this->config[ 'ssl' ][ 'enabled' ])) {
220 220
                 if (!empty($this->config[ 'ssl' ][ 'verify' ])) {
@@ -242,8 +242,8 @@  discard block
 block discarded – undo
242 242
              */
243 243
 
244 244
             $this->instance->execute(new Cassandra\SimpleStatement(sprintf(
245
-              "CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };",
246
-              self::CASSANDRA_KEY_SPACE
245
+                "CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };",
246
+                self::CASSANDRA_KEY_SPACE
247 247
             )));
248 248
             $this->instance->execute(new Cassandra\SimpleStatement(sprintf('USE %s;', self::CASSANDRA_KEY_SPACE)));
249 249
             $this->instance->execute(new Cassandra\SimpleStatement(sprintf('
@@ -290,15 +290,15 @@  discard block
 block discarded – undo
290 290
     public function getStats()
291 291
     {
292 292
         $result = $this->instance->execute(new Cassandra\SimpleStatement(sprintf(
293
-          'SELECT SUM(cache_length) as cache_size FROM %s.%s',
294
-          self::CASSANDRA_KEY_SPACE,
295
-          self::CASSANDRA_TABLE
293
+            'SELECT SUM(cache_length) as cache_size FROM %s.%s',
294
+            self::CASSANDRA_KEY_SPACE,
295
+            self::CASSANDRA_TABLE
296 296
         )));
297 297
 
298 298
         return (new DriverStatistic())
299
-          ->setSize($result->first()[ 'cache_size' ])
300
-          ->setRawData([])
301
-          ->setData(implode(', ', array_keys($this->itemInstances)))
302
-          ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.');
299
+            ->setSize($result->first()[ 'cache_size' ])
300
+            ->setRawData([])
301
+            ->setData(implode(', ', array_keys($this->itemInstances)))
302
+            ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.');
303 303
     }
304 304
 }
305 305
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             $results = $this->instance->execute(new Cassandra\SimpleStatement($query), $options);
134 134
 
135 135
             if ($results instanceof Cassandra\Rows && $results->count() === 1) {
136
-                return $this->decode($results->first()[ 'cache_data' ]);
136
+                return $this->decode($results->first()['cache_data']);
137 137
             } else {
138 138
                 return null;
139 139
             }
@@ -206,18 +206,18 @@  discard block
 block discarded – undo
206 206
         if ($this->instance instanceof CassandraSession) {
207 207
             throw new phpFastCacheLogicException('Already connected to Couchbase server');
208 208
         } else {
209
-            $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1';
210
-            $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : 9042;
211
-            $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : 2;
212
-            $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
213
-            $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
209
+            $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1';
210
+            $port = isset($this->config['port']) ? $this->config['port'] : 9042;
211
+            $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 2;
212
+            $password = isset($this->config['password']) ? $this->config['password'] : '';
213
+            $username = isset($this->config['username']) ? $this->config['username'] : '';
214 214
 
215 215
             $clusterBuilder = Cassandra::cluster()
216 216
               ->withContactPoints($host)
217 217
               ->withPort($port);
218 218
 
219
-            if (!empty($this->config[ 'ssl' ][ 'enabled' ])) {
220
-                if (!empty($this->config[ 'ssl' ][ 'verify' ])) {
219
+            if (!empty($this->config['ssl']['enabled'])) {
220
+                if (!empty($this->config['ssl']['verify'])) {
221 221
                     $sslBuilder = Cassandra::ssl()->withVerifyFlags(Cassandra::VERIFY_PEER_CERT);
222 222
                 } else {
223 223
                     $sslBuilder = Cassandra::ssl()->withVerifyFlags(Cassandra::VERIFY_NONE);
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         )));
297 297
 
298 298
         return (new DriverStatistic())
299
-          ->setSize($result->first()[ 'cache_size' ])
299
+          ->setSize($result->first()['cache_size'])
300 300
           ->setRawData([])
301 301
           ->setData(implode(', ', array_keys($this->itemInstances)))
302 302
           ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.');
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Files/Driver.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
     /**
62 62
      * @param \Psr\Cache\CacheItemInterface $item
63
-     * @return mixed
63
+     * @return boolean
64 64
      * @throws phpFastCacheInvalidArgumentException
65 65
      */
66 66
     protected function driverWrite(CacheItemInterface $item)
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
     /**
147 147
      * @param string $optionName
148 148
      * @param mixed $optionValue
149
-     * @return bool
149
+     * @return boolean|null
150 150
      * @throws phpFastCacheInvalidArgumentException
151 151
      */
152 152
     public static function isValidOption($optionName, $optionValue)
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     }
180 180
 
181 181
     /**
182
-     * @return array
182
+     * @return string[]
183 183
      */
184 184
     public static function getValidOptions()
185 185
     {
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     }
188 188
 
189 189
     /**
190
-     * @return array
190
+     * @return string[]
191 191
      */
192 192
     public static function getRequiredOptions()
193 193
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
              * Force write
77 77
              */
78 78
             try {
79
-                return $this->writefile($file_path, $data, $this->config[ 'secureFileManipulation' ]);
79
+                return $this->writefile($file_path, $data, $this->config['secureFileManipulation']);
80 80
             } catch (\Exception $e) {
81 81
                 return false;
82 82
             }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     protected function driverClear()
138 138
     {
139
-        return (bool)Directory::rrmdir($this->getPath(true));
139
+        return (bool) Directory::rrmdir($this->getPath(true));
140 140
     }
141 141
 
142 142
     /**
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Cookie/Item.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
             $this->driver->setItem($this);
44 44
         } else {
45 45
             throw new phpFastCacheInvalidArgumentException(sprintf('$key must be a string, got type "%s" instead.',
46
-              gettype($key)));
46
+                gettype($key)));
47 47
         }
48 48
     }
49 49
 
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Devfalse/Driver.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 
63 63
     /**
64 64
      * @param \Psr\Cache\CacheItemInterface $item
65
-     * @return mixed
65
+     * @return boolean
66 66
      * @throws phpFastCacheInvalidArgumentException
67 67
      */
68 68
     protected function driverWrite(CacheItemInterface $item)
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
     protected function driverRead(CacheItemInterface $item)
77 77
     {
78 78
         return [
79
-          self::DRIVER_DATA_WRAPPER_INDEX => false,
80
-          self::DRIVER_TAGS_WRAPPER_INDEX => [],
81
-          self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(),
79
+            self::DRIVER_DATA_WRAPPER_INDEX => false,
80
+            self::DRIVER_TAGS_WRAPPER_INDEX => [],
81
+            self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(),
82 82
         ];
83 83
     }
84 84
 
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
     {
129 129
         $stat = new DriverStatistic();
130 130
         $stat->setInfo('[Devfalse] A void info string')
131
-          ->setSize(0)
132
-          ->setData(implode(', ', array_keys($this->itemInstances)))
133
-          ->setRawData(false);
131
+            ->setSize(0)
132
+            ->setData(implode(', ', array_keys($this->itemInstances)))
133
+            ->setRawData(false);
134 134
 
135 135
         return $stat;
136 136
     }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Devnull/Driver.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 
63 63
     /**
64 64
      * @param \Psr\Cache\CacheItemInterface $item
65
-     * @return mixed
65
+     * @return boolean
66 66
      * @throws phpFastCacheInvalidArgumentException
67 67
      */
68 68
     protected function driverWrite(CacheItemInterface $item)
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -127,9 +127,9 @@
 block discarded – undo
127 127
     {
128 128
         $stat = new DriverStatistic();
129 129
         $stat->setInfo('[Devnull] A void info string')
130
-          ->setSize(0)
131
-          ->setData(implode(', ', array_keys($this->itemInstances)))
132
-          ->setRawData(null);
130
+            ->setSize(0)
131
+            ->setData(implode(', ', array_keys($this->itemInstances)))
132
+            ->setRawData(null);
133 133
 
134 134
         return $stat;
135 135
     }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Devtrue/Driver.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 
63 63
     /**
64 64
      * @param \Psr\Cache\CacheItemInterface $item
65
-     * @return mixed
65
+     * @return boolean
66 66
      * @throws phpFastCacheInvalidArgumentException
67 67
      */
68 68
     protected function driverWrite(CacheItemInterface $item)
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
     protected function driverRead(CacheItemInterface $item)
81 81
     {
82 82
         return [
83
-          self::DRIVER_DATA_WRAPPER_INDEX => true,
84
-          self::DRIVER_TAGS_WRAPPER_INDEX => [],
85
-          self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(),
83
+            self::DRIVER_DATA_WRAPPER_INDEX => true,
84
+            self::DRIVER_TAGS_WRAPPER_INDEX => [],
85
+            self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(),
86 86
         ];
87 87
     }
88 88
 
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
     {
133 133
         $stat = new DriverStatistic();
134 134
         $stat->setInfo('[Devtrue] A void info string')
135
-          ->setSize(0)
136
-          ->setData(implode(', ', array_keys($this->itemInstances)))
137
-          ->setRawData(true);
135
+            ->setSize(0)
136
+            ->setData(implode(', ', array_keys($this->itemInstances)))
137
+            ->setRawData(true);
138 138
 
139 139
         return $stat;
140 140
     }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Mongodb/Driver.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
 
77 77
     /**
78 78
      * @param \Psr\Cache\CacheItemInterface $item
79
-     * @return mixed
79
+     * @return boolean
80 80
      * @throws phpFastCacheInvalidArgumentException
81 81
      * @throws phpFastCacheDriverException
82 82
      */
Please login to merge, or discard this patch.
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -88,15 +88,15 @@  discard block
 block discarded – undo
88 88
         if ($item instanceof Item) {
89 89
             try {
90 90
                 $result = (array)$this->getCollection()->updateOne(
91
-                  ['_id' => $item->getEncodedKey()],
92
-                  [
91
+                    ['_id' => $item->getEncodedKey()],
92
+                    [
93 93
                     '$set' => [
94
-                      self::DRIVER_DATA_WRAPPER_INDEX => new Binary($this->encode($item->get()), Binary::TYPE_GENERIC),
95
-                      self::DRIVER_TAGS_WRAPPER_INDEX => new Binary($this->encode($item->getTags()), Binary::TYPE_GENERIC),
96
-                      self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((time() + $item->getTtl()) * 1000) : new UTCDateTime(time() * 1000)),
94
+                        self::DRIVER_DATA_WRAPPER_INDEX => new Binary($this->encode($item->get()), Binary::TYPE_GENERIC),
95
+                        self::DRIVER_TAGS_WRAPPER_INDEX => new Binary($this->encode($item->getTags()), Binary::TYPE_GENERIC),
96
+                        self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((time() + $item->getTtl()) * 1000) : new UTCDateTime(time() * 1000)),
97 97
                     ],
98
-                  ],
99
-                  ['upsert' => true, 'multiple' => false]
98
+                    ],
99
+                    ['upsert' => true, 'multiple' => false]
100 100
                 );
101 101
             } catch (MongoDBException $e) {
102 102
                 throw new phpFastCacheDriverException('Got an exception while trying to write data to MongoDB server', null, $e);
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 
119 119
         if ($document) {
120 120
             return [
121
-              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->getData()),
122
-              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->getData()),
123
-              self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->toDateTime()->getTimestamp()),
121
+                self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->getData()),
122
+                self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->getData()),
123
+                self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->toDateTime()->getTimestamp()),
124 124
             ];
125 125
         } else {
126 126
             return null;
@@ -191,10 +191,10 @@  discard block
 block discarded – undo
191 191
              * @todo make an url builder
192 192
              */
193 193
             $this->instance = $this->instance ?: (new MongodbManager('mongodb://' .
194
-              ($username ?: '') .
195
-              ($password ? ":{$password}" : '') .
196
-              ($username ? '@' : '') . "{$host}" .
197
-              ($port != '27017' ? ":{$port}" : ''), ['connectTimeoutMS' => $timeout * 1000]));
194
+                ($username ?: '') .
195
+                ($password ? ":{$password}" : '') .
196
+                ($username ? '@' : '') . "{$host}" .
197
+                ($port != '27017' ? ":{$port}" : ''), ['connectTimeoutMS' => $timeout * 1000]));
198 198
             $this->collection = $this->collection ?: new Collection($this->instance, $databaseName, $collectionName);
199 199
 
200 200
             return true;
@@ -222,15 +222,15 @@  discard block
 block discarded – undo
222 222
     public function getStats()
223 223
     {
224 224
         $serverStats = $this->instance->executeCommand('phpFastCache', new Command([
225
-          'serverStatus' => 1,
226
-          'recordStats' => 0,
227
-          'repl' => 0,
228
-          'metrics' => 0,
225
+            'serverStatus' => 1,
226
+            'recordStats' => 0,
227
+            'repl' => 0,
228
+            'metrics' => 0,
229 229
         ]))->toArray()[ 0 ];
230 230
 
231 231
         $collectionStats = $this->instance->executeCommand('phpFastCache', new Command([
232
-          'collStats' => (isset($this->config[ 'collectionName' ]) ? $this->config[ 'collectionName' ] : 'Cache'),
233
-          'verbose' => true,
232
+            'collStats' => (isset($this->config[ 'collectionName' ]) ? $this->config[ 'collectionName' ] : 'Cache'),
233
+            'verbose' => true,
234 234
         ]))->toArray()[ 0 ];
235 235
 
236 236
         $array_filter_recursive = function ($array, callable $callback = null) use (&$array_filter_recursive) {
@@ -259,14 +259,14 @@  discard block
 block discarded – undo
259 259
         $collectionStats = $array_filter_recursive($collectionStats, $callback);
260 260
 
261 261
         $stats = (new DriverStatistic())
262
-          ->setInfo('MongoDB version ' . $serverStats->version . ', Uptime (in days): ' . round($serverStats->uptime / 86400,
263
-              1) . "\n For more information see RawData.")
264
-          ->setSize($collectionStats->size)
265
-          ->setData(implode(', ', array_keys($this->itemInstances)))
266
-          ->setRawData([
262
+            ->setInfo('MongoDB version ' . $serverStats->version . ', Uptime (in days): ' . round($serverStats->uptime / 86400,
263
+                1) . "\n For more information see RawData.")
264
+            ->setSize($collectionStats->size)
265
+            ->setData(implode(', ', array_keys($this->itemInstances)))
266
+            ->setRawData([
267 267
             'serverStatus' => $serverStats,
268 268
             'collStats' => $collectionStats,
269
-          ]);
269
+            ]);
270 270
 
271 271
         return $stats;
272 272
     }
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
          */
88 88
         if ($item instanceof Item) {
89 89
             try {
90
-                $result = (array)$this->getCollection()->updateOne(
90
+                $result = (array) $this->getCollection()->updateOne(
91 91
                   ['_id' => $item->getEncodedKey()],
92 92
                   [
93 93
                     '$set' => [
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
                 throw new phpFastCacheDriverException('Got an exception while trying to write data to MongoDB server', null, $e);
103 103
             }
104 104
 
105
-            return isset($result[ 'ok' ]) ? $result[ 'ok' ] == 1 : true;
105
+            return isset($result['ok']) ? $result['ok'] == 1 : true;
106 106
         } else {
107 107
             throw new phpFastCacheInvalidArgumentException('Cross-Driver type confusion detected');
108 108
         }
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 
119 119
         if ($document) {
120 120
             return [
121
-              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->getData()),
122
-              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->getData()),
123
-              self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->toDateTime()->getTimestamp()),
121
+              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[self::DRIVER_DATA_WRAPPER_INDEX]->getData()),
122
+              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[self::DRIVER_TAGS_WRAPPER_INDEX]->getData()),
123
+              self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_EDATE_WRAPPER_INDEX]->toDateTime()->getTimestamp()),
124 124
             ];
125 125
         } else {
126 126
             return null;
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
          */
166 166
         $this->save($this->getItem('__PFC_CACHE_CLEARED__')->set(true));
167 167
 
168
-        return !empty($result[ 'ok' ]);
168
+        return !empty($result['ok']);
169 169
     }
170 170
 
171 171
     /**
@@ -178,13 +178,13 @@  discard block
 block discarded – undo
178 178
         if ($this->instance instanceof \MongoDB\Driver\Manager) {
179 179
             throw new LogicException('Already connected to Mongodb server');
180 180
         } else {
181
-            $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1';
182
-            $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : '27017';
183
-            $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : 3;
184
-            $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
185
-            $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
186
-            $collectionName = isset($this->config[ 'collectionName' ]) ? $this->config[ 'collectionName' ] : 'Cache';
187
-            $databaseName = isset($this->config[ 'databaseName' ]) ? $this->config[ 'databaseName' ] : 'phpFastCache';
181
+            $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1';
182
+            $port = isset($this->config['port']) ? $this->config['port'] : '27017';
183
+            $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 3;
184
+            $password = isset($this->config['password']) ? $this->config['password'] : '';
185
+            $username = isset($this->config['username']) ? $this->config['username'] : '';
186
+            $collectionName = isset($this->config['collectionName']) ? $this->config['collectionName'] : 'Cache';
187
+            $databaseName = isset($this->config['databaseName']) ? $this->config['databaseName'] : 'phpFastCache';
188 188
 
189 189
 
190 190
             /**
@@ -226,14 +226,14 @@  discard block
 block discarded – undo
226 226
           'recordStats' => 0,
227 227
           'repl' => 0,
228 228
           'metrics' => 0,
229
-        ]))->toArray()[ 0 ];
229
+        ]))->toArray()[0];
230 230
 
231 231
         $collectionStats = $this->instance->executeCommand('phpFastCache', new Command([
232
-          'collStats' => (isset($this->config[ 'collectionName' ]) ? $this->config[ 'collectionName' ] : 'Cache'),
232
+          'collStats' => (isset($this->config['collectionName']) ? $this->config['collectionName'] : 'Cache'),
233 233
           'verbose' => true,
234
-        ]))->toArray()[ 0 ];
234
+        ]))->toArray()[0];
235 235
 
236
-        $array_filter_recursive = function ($array, callable $callback = null) use (&$array_filter_recursive) {
236
+        $array_filter_recursive = function($array, callable $callback = null) use (&$array_filter_recursive) {
237 237
             $array = $callback($array);
238 238
 
239 239
             if (is_object($array) || is_array($array)) {
@@ -245,12 +245,12 @@  discard block
 block discarded – undo
245 245
             return $array;
246 246
         };
247 247
 
248
-        $callback = function ($item) {
248
+        $callback = function($item) {
249 249
             /**
250 250
              * Remove unserializable properties
251 251
              */
252 252
             if ($item instanceof \MongoDB\BSON\UTCDateTime) {
253
-                return (string)$item;
253
+                return (string) $item;
254 254
             }
255 255
             return $item;
256 256
         };
Please login to merge, or discard this patch.
src/phpFastCache/Entities/DriverStatistic.php 2 patches
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.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -123,10 +123,10 @@
 block discarded – undo
123 123
     public function getPublicDesc()
124 124
     {
125 125
         return [
126
-          'Info' => 'Cache Information',
127
-          'Size' => 'Cache Size',
128
-          'Data' => 'Cache items keys',
129
-          'RawData' => 'Cache raw data',
126
+            'Info' => 'Cache Information',
127
+            'Size' => 'Cache Size',
128
+            'Data' => 'Cache items keys',
129
+            'RawData' => 'Cache raw data',
130 130
         ];
131 131
     }
132 132
 }
133 133
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Wincache/Driver.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -133,9 +133,9 @@
 block discarded – undo
133 133
         $date = (new \DateTime())->setTimestamp(time() - $info[ 'total_cache_uptime' ]);
134 134
 
135 135
         return (new DriverStatistic())
136
-          ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822)))
137
-          ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ])
138
-          ->setData(implode(', ', array_keys($this->itemInstances)))
139
-          ->setRawData($memInfo);
136
+            ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822)))
137
+            ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ])
138
+            ->setData(implode(', ', array_keys($this->itemInstances)))
139
+            ->setRawData($memInfo);
140 140
     }
141 141
 }
142 142
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -130,11 +130,11 @@
 block discarded – undo
130 130
     {
131 131
         $memInfo = wincache_ucache_meminfo();
132 132
         $info = wincache_ucache_info();
133
-        $date = (new \DateTime())->setTimestamp(time() - $info[ 'total_cache_uptime' ]);
133
+        $date = (new \DateTime())->setTimestamp(time() - $info['total_cache_uptime']);
134 134
 
135 135
         return (new DriverStatistic())
136 136
           ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822)))
137
-          ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ])
137
+          ->setSize($memInfo['memory_free'] - $memInfo['memory_total'])
138 138
           ->setData(implode(', ', array_keys($this->itemInstances)))
139 139
           ->setRawData($memInfo);
140 140
     }
Please login to merge, or discard this patch.