Completed
Branch final (ad8b8d)
by Georges
03:08 queued 28s
created
src/phpFastCache/Drivers/Leveldb/Driver.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@
 block discarded – undo
128 128
     }
129 129
 
130 130
     /**
131
-     * @return bool
131
+     * @return boolean|null
132 132
      */
133 133
     public function driverConnect()
134 134
     {
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -176,9 +176,9 @@
 block discarded – undo
176 176
     public function getStats()
177 177
     {
178 178
         return (new driverStatistic())
179
-          ->setData(implode(', ', array_keys($this->itemInstances)))
180
-          ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($this->getLeveldbFile()))
181
-          ->setSize(Directory::dirSize($this->getLeveldbFile()));
179
+            ->setData(implode(', ', array_keys($this->itemInstances)))
180
+            ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($this->getLeveldbFile()))
181
+            ->setSize(Directory::dirSize($this->getLeveldbFile()));
182 182
     }
183 183
 
184 184
     /**
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
 namespace phpFastCache\Drivers\Wincache;
16 16
 
17 17
 use phpFastCache\Core\DriverAbstract;
18
-use phpFastCache\Core\StandardPsr6StructureTrait;
19 18
 use phpFastCache\Entities\driverStatistic;
20 19
 use phpFastCache\Exceptions\phpFastCacheDriverCheckException;
21 20
 use phpFastCache\Exceptions\phpFastCacheDriverException;
Please login to merge, or discard this patch.
src/phpFastCache/Cache/DriverBaseTrait.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@
 block discarded – undo
115 115
 
116 116
 
117 117
     /**
118
-     * @param $file
118
+     * @param string $file
119 119
      * @return string
120 120
      * @throws \Exception
121 121
      */
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -214,9 +214,9 @@
 block discarded – undo
214 214
     public function driverPreWrap(ExtendedCacheItemInterface $item)
215 215
     {
216 216
         return [
217
-          self::DRIVER_DATA_WRAPPER_INDEX => $item->get(),
218
-          self::DRIVER_TIME_WRAPPER_INDEX => $item->getExpirationDate(),
219
-          self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(),
217
+            self::DRIVER_DATA_WRAPPER_INDEX => $item->get(),
218
+            self::DRIVER_TIME_WRAPPER_INDEX => $item->getExpirationDate(),
219
+            self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(),
220 220
         ];
221 221
     }
222 222
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         if (is_array($config_name)) {
68 68
             $this->config = array_merge($this->config, $config_name);
69 69
         } else {
70
-            $this->config[ $config_name ] = $value;
70
+            $this->config[$config_name] = $value;
71 71
         }
72 72
     }
73 73
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
      */
185 185
     public function driverUnwrapData(array $wrapper)
186 186
     {
187
-        return $wrapper[ self::DRIVER_DATA_WRAPPER_INDEX ];
187
+        return $wrapper[self::DRIVER_DATA_WRAPPER_INDEX];
188 188
     }
189 189
 
190 190
     /**
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
      */
194 194
     public function driverUnwrapTags(array $wrapper)
195 195
     {
196
-        return $wrapper[ self::DRIVER_TAGS_WRAPPER_INDEX ];
196
+        return $wrapper[self::DRIVER_TAGS_WRAPPER_INDEX];
197 197
     }
198 198
 
199 199
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      */
204 204
     public function driverUnwrapTime(array $wrapper)
205 205
     {
206
-        return $wrapper[ self::DRIVER_TIME_WRAPPER_INDEX ];
206
+        return $wrapper[self::DRIVER_TIME_WRAPPER_INDEX];
207 207
     }
208 208
 
209 209
     /**
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
         foreach ($tagsItems as $tagsItem) {
258 258
             $data = (array) $tagsItem->get();
259 259
 
260
-            unset($data[ $item->getKey() ]);
260
+            unset($data[$item->getKey()]);
261 261
             $tagsItem->set($data);
262 262
 
263 263
             /**
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Files/Driver.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
     /**
57 57
      * @param \Psr\Cache\CacheItemInterface $item
58
-     * @return mixed
58
+     * @return boolean|null
59 59
      * @throws \InvalidArgumentException
60 60
      */
61 61
     public function driverWrite(CacheItemInterface $item)
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     /**
212 212
      * @param string $optionName
213 213
      * @param mixed $optionValue
214
-     * @return bool
214
+     * @return boolean|null
215 215
      * @throws \InvalidArgumentException
216 216
      */
217 217
     public static function isValidOption($optionName, $optionValue)
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         }
240 240
     }
241 241
     /**
242
-     * @return array
242
+     * @return string[]
243 243
      */
244 244
     public static function getValidOptions()
245 245
     {
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
     }
248 248
 
249 249
     /**
250
-     * @return array
250
+     * @return string[]
251 251
      */
252 252
     public static function getRequiredOptions()
253 253
     {
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -254,9 +254,9 @@
 block discarded – undo
254 254
         }
255 255
 
256 256
         $stat->setData(implode(', ', array_keys($this->itemInstances)))
257
-          ->setRawData([])
258
-          ->setSize(Directory::dirSize($path))
259
-          ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path));
257
+            ->setRawData([])
258
+            ->setSize(Directory::dirSize($path))
259
+            ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path));
260 260
 
261 261
         return $stat;
262 262
     }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
             /*
76 76
              * Skip if Existing Caching in Options
77 77
              */
78
-            if (isset($option[ 'skipExisting' ]) && $option[ 'skipExisting' ] == true && file_exists($file_path)) {
78
+            if (isset($option['skipExisting']) && $option['skipExisting'] == true && file_exists($file_path)) {
79 79
                 $content = $this->readfile($file_path);
80 80
                 $old = $this->decode($content);
81 81
                 $toWrite = false;
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
 namespace phpFastCache\Drivers\Wincache;
16 16
 
17 17
 use phpFastCache\Core\DriverAbstract;
18
-use phpFastCache\Core\StandardPsr6StructureTrait;
19 18
 use phpFastCache\Entities\driverStatistic;
20 19
 use phpFastCache\Exceptions\phpFastCacheDriverCheckException;
21 20
 use phpFastCache\Exceptions\phpFastCacheDriverException;
Please login to merge, or discard this patch.
src/phpFastCache/Core/PathSeekerTrait.php 3 patches
Doc Comments   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,6 @@  discard block
 block discarded – undo
25 25
     public $tmp = [];
26 26
 
27 27
     /**
28
-     * @param bool $skip_create_path
29 28
      * @param $config
30 29
      * @return string
31 30
      * @throws \Exception
@@ -118,7 +117,7 @@  discard block
 block discarded – undo
118 117
     }
119 118
 
120 119
     /**
121
-     * @param $keyword
120
+     * @param string|false $keyword
122 121
      * @param bool $skip
123 122
      * @return string
124 123
      * @throws phpFastCacheDriverException
@@ -165,7 +164,7 @@  discard block
 block discarded – undo
165 164
 
166 165
     /**
167 166
      * @param $filename
168
-     * @return mixed
167
+     * @return string
169 168
      */
170 169
     protected static function cleanFileName($filename)
171 170
     {
@@ -180,7 +179,7 @@  discard block
 block discarded – undo
180 179
     }
181 180
 
182 181
     /**
183
-     * @param $path
182
+     * @param string $path
184 183
      * @param bool $create
185 184
      * @throws \Exception
186 185
      */
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -185,9 +185,9 @@
 block discarded – undo
185 185
     protected static function cleanFileName($filename)
186 186
     {
187 187
         $regex = [
188
-          '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/',
189
-          '/\.$/',
190
-          '/^\./',
188
+            '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/',
189
+            '/\.$/',
190
+            '/^\./',
191 191
         ];
192 192
         $replace = ['-', '', ''];
193 193
 
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -34,30 +34,30 @@  discard block
 block discarded – undo
34 34
     {
35 35
         $tmp_dir = rtrim(ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir(), '\\/') . DIRECTORY_SEPARATOR . 'phpfastcache';
36 36
 
37
-        if (!isset($this->config[ 'path' ]) || $this->config[ 'path' ] == '') {
37
+        if (!isset($this->config['path']) || $this->config['path'] == '') {
38 38
             if (self::isPHPModule()) {
39 39
                 $path = $tmp_dir;
40 40
             } else {
41
-                $document_root_path = rtrim($_SERVER[ 'DOCUMENT_ROOT' ], '/') . '/../';
42
-                $path = isset($_SERVER[ 'DOCUMENT_ROOT' ]) && is_writable($document_root_path) ? $document_root_path : rtrim(__DIR__, '/') . '/';
41
+                $document_root_path = rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/../';
42
+                $path = isset($_SERVER['DOCUMENT_ROOT']) && is_writable($document_root_path) ? $document_root_path : rtrim(__DIR__, '/') . '/';
43 43
             }
44 44
 
45
-            if ($this->config[ 'path' ] != '') {
46
-                $path = $this->config[ 'path' ];
45
+            if ($this->config['path'] != '') {
46
+                $path = $this->config['path'];
47 47
             }
48 48
 
49 49
         } else {
50
-            $path = $this->config[ 'path' ];
50
+            $path = $this->config['path'];
51 51
         }
52 52
 
53 53
         if ($getBasePath === true) {
54 54
             return $path;
55 55
         }
56 56
 
57
-        $securityKey = array_key_exists('securityKey', $this->config) ? $this->config[ 'securityKey' ] : '';
57
+        $securityKey = array_key_exists('securityKey', $this->config) ? $this->config['securityKey'] : '';
58 58
         if (!$securityKey || $securityKey === 'auto') {
59
-            if (isset($_SERVER[ 'HTTP_HOST' ])) {
60
-                $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER[ 'HTTP_HOST' ])));
59
+            if (isset($_SERVER['HTTP_HOST'])) {
60
+                $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER['HTTP_HOST'])));
61 61
             } else {
62 62
                 $securityKey = ($this->isPHPModule() ? 'web' : 'cli');
63 63
             }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         $full_pathx = md5($full_path);
74 74
 
75 75
 
76
-        if (!isset($this->tmp[ $full_pathx ])) {
76
+        if (!isset($this->tmp[$full_pathx])) {
77 77
 
78 78
             if (!@file_exists($full_path) || !@is_writable($full_path)) {
79 79
                 if (!@file_exists($full_path)) {
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
                 }
98 98
             }
99 99
 
100
-            $this->tmp[ $full_pathx ] = true;
101
-            $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config[ 'htaccess' ] : false);
100
+            $this->tmp[$full_pathx] = true;
101
+            $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config['htaccess'] : false);
102 102
         }
103 103
 
104 104
         return realpath($full_path);
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function setChmodAuto()
173 173
     {
174
-        if (!isset($this->config[ 'default_chmod' ]) || $this->config[ 'default_chmod' ] == '' || is_null($this->config[ 'default_chmod' ])) {
174
+        if (!isset($this->config['default_chmod']) || $this->config['default_chmod'] == '' || is_null($this->config['default_chmod'])) {
175 175
             return 0777;
176 176
         } else {
177
-            return $this->config[ 'default_chmod' ];
177
+            return $this->config['default_chmod'];
178 178
         }
179 179
     }
180 180
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         if ($create === true) {
205 205
             if (!is_writable($path)) {
206 206
                 try {
207
-                    if(!chmod($path, 0777)){
207
+                    if (!chmod($path, 0777)) {
208 208
                         throw new phpFastCacheDriverException('Chmod failed on : ' . $path);
209 209
                     }
210 210
                 } catch (phpFastCacheDriverException $e) {
Please login to merge, or discard this patch.
src/phpFastCache/Util/Directory.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,8 +83,8 @@
 block discarded – undo
83 83
 
84 84
         $files = new RecursiveIteratorIterator
85 85
         (
86
-          new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS),
87
-          RecursiveIteratorIterator::CHILD_FIRST
86
+            new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS),
87
+            RecursiveIteratorIterator::CHILD_FIRST
88 88
         );
89 89
         
90 90
         foreach ($files as $fileinfo) {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@  discard block
 block discarded – undo
81 81
             return unlink($source);
82 82
         }
83 83
 
84
-        $files = new RecursiveIteratorIterator
85
-        (
84
+        $files = new RecursiveIteratorIterator(
86 85
           new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS),
87 86
           RecursiveIteratorIterator::CHILD_FIRST
88 87
         );
@@ -95,7 +94,7 @@  discard block
 block discarded – undo
95 94
                 if (self::rrmdir($fileinfo->getRealPath()) === false) {
96 95
                     return false;
97 96
                 }
98
-            } else if(unlink($fileinfo->getRealPath()) === false) {
97
+            } else if (unlink($fileinfo->getRealPath()) === false) {
99 98
                 return false;
100 99
             }
101 100
         }
Please login to merge, or discard this patch.
src/phpFastCache/Entities/driverStatistic.php 1 patch
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     protected $rawData;
45 45
 
46 46
     /**
47
-     * @return string|bool Return infos or false if no information available
47
+     * @return string Return infos or false if no information available
48 48
      */
49 49
     public function getInfo()
50 50
     {
@@ -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/Drivers/Devfalse/Driver.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -140,9 +140,9 @@
 block discarded – undo
140 140
     {
141 141
         $stat = new driverStatistic();
142 142
         $stat->setInfo('[Devfalse] A void info string')
143
-          ->setSize(0)
144
-          ->setData(implode(', ', array_keys($this->itemInstances)))
145
-          ->setRawData(false);
143
+            ->setSize(0)
144
+            ->setData(implode(', ', array_keys($this->itemInstances)))
145
+            ->setRawData(false);
146 146
 
147 147
         return $stat;
148 148
     }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Devnull/Driver.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -140,9 +140,9 @@
 block discarded – undo
140 140
     {
141 141
         $stat = new driverStatistic();
142 142
         $stat->setInfo('[Devnull] A void info string')
143
-          ->setSize(0)
144
-          ->setData(implode(', ', array_keys($this->itemInstances)))
145
-          ->setRawData(null);
143
+            ->setSize(0)
144
+            ->setData(implode(', ', array_keys($this->itemInstances)))
145
+            ->setRawData(null);
146 146
 
147 147
         return $stat;
148 148
     }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
 
58 58
     /**
59 59
      * @param \Psr\Cache\CacheItemInterface $item
60
-     * @return mixed
60
+     * @return boolean
61 61
      * @throws \InvalidArgumentException
62 62
      */
63 63
     public function driverWrite(CacheItemInterface $item)
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
 namespace phpFastCache\Drivers\Wincache;
16 16
 
17 17
 use phpFastCache\Core\DriverAbstract;
18
-use phpFastCache\Core\StandardPsr6StructureTrait;
19 18
 use phpFastCache\Entities\driverStatistic;
20 19
 use phpFastCache\Exceptions\phpFastCacheDriverCheckException;
21 20
 use phpFastCache\Exceptions\phpFastCacheDriverException;
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Mongodb/Driver.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
     /**
55 55
      * @param \Psr\Cache\CacheItemInterface $item
56
-     * @return mixed
56
+     * @return boolean
57 57
      * @throws \InvalidArgumentException
58 58
      */
59 59
     public function driverWrite(CacheItemInterface $item)
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
     /**
114 114
      * @param \Psr\Cache\CacheItemInterface $item
115
-     * @return bool
115
+     * @return boolean|null
116 116
      * @throws \InvalidArgumentException
117 117
      */
118 118
     public function driverIsHit(CacheItemInterface $item)
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                 return false;
93 93
             }
94 94
 
95
-            return isset($result[ 'ok' ]) ? $result[ 'ok' ] == 1 : true;
95
+            return isset($result['ok']) ? $result['ok'] == 1 : true;
96 96
         } else {
97 97
             throw new \InvalidArgumentException('Cross-Driver type confusion detected');
98 98
         }
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 
109 109
         if ($document) {
110 110
             return [
111
-              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin),
112
-              self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec),
113
-              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin),
111
+              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[self::DRIVER_DATA_WRAPPER_INDEX]->bin),
112
+              self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_TIME_WRAPPER_INDEX]->sec),
113
+              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[self::DRIVER_TAGS_WRAPPER_INDEX]->bin),
114 114
             ];
115 115
         } else {
116 116
             return null;
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         if ($item instanceof Item) {
131 131
             $deletionResult = (array) $this->getCollection()->remove(['_id' => $item->getKey()], ["w" => 1]);
132 132
 
133
-            return (int) $deletionResult[ 'ok' ] === 1 && !$deletionResult[ 'err' ];
133
+            return (int) $deletionResult['ok'] === 1 && !$deletionResult['err'];
134 134
         } else {
135 135
             throw new \InvalidArgumentException('Cross-Driver type confusion detected');
136 136
         }
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
         if ($this->instance instanceof MongodbClient) {
155 155
             throw new LogicException('Already connected to Mongodb server');
156 156
         } else {
157
-            $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1';
158
-            $port = isset($server[ 'port' ]) ? $server[ 'port' ] : '27017';
159
-            $timeout = isset($server[ 'timeout' ]) ? $server[ 'timeout' ] : 3;
160
-            $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
161
-            $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
157
+            $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1';
158
+            $port = isset($server['port']) ? $server['port'] : '27017';
159
+            $timeout = isset($server['timeout']) ? $server['timeout'] : 3;
160
+            $password = isset($this->config['password']) ? $this->config['password'] : '';
161
+            $username = isset($this->config['username']) ? $this->config['username'] : '';
162 162
 
163 163
 
164 164
             /**
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
         ]);
207 207
 
208 208
         $stats = (new driverStatistic())
209
-          ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.")
210
-          ->setSize((int) @$collStats[ 'size' ])
209
+          ->setInfo('MongoDB version ' . $serverStatus['version'] . ', Uptime (in days): ' . round($serverStatus['uptime'] / 86400, 1) . "\n For more information see RawData.")
210
+          ->setSize((int) @$collStats['size'])
211 211
           ->setData(implode(', ', array_keys($this->itemInstances)))
212 212
           ->setRawData([
213 213
             'serverStatus' => $serverStatus,
Please login to merge, or discard this patch.
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
         if ($item instanceof Item) {
79 79
             try {
80 80
                 $result = (array) $this->getCollection()->update(
81
-                  ['_id' => $item->getKey()],
82
-                  [
81
+                    ['_id' => $item->getKey()],
82
+                    [
83 83
                     '$set' => [
84
-                      self::DRIVER_TIME_WRAPPER_INDEX => ($item->getTtl() > 0 ? new MongoDate(time() + $item->getTtl()) : new MongoDate(time())),
85
-                      self::DRIVER_DATA_WRAPPER_INDEX => new MongoBinData($this->encode($item->get()), MongoBinData::BYTE_ARRAY),
86
-                      self::DRIVER_TAGS_WRAPPER_INDEX => new MongoBinData($this->encode($item->getTags()), MongoBinData::BYTE_ARRAY),
84
+                        self::DRIVER_TIME_WRAPPER_INDEX => ($item->getTtl() > 0 ? new MongoDate(time() + $item->getTtl()) : new MongoDate(time())),
85
+                        self::DRIVER_DATA_WRAPPER_INDEX => new MongoBinData($this->encode($item->get()), MongoBinData::BYTE_ARRAY),
86
+                        self::DRIVER_TAGS_WRAPPER_INDEX => new MongoBinData($this->encode($item->getTags()), MongoBinData::BYTE_ARRAY),
87 87
                     ],
88
-                  ],
89
-                  ['upsert' => true, 'multiple' => false]
88
+                    ],
89
+                    ['upsert' => true, 'multiple' => false]
90 90
                 );
91 91
             } catch (MongoCursorException $e) {
92 92
                 return false;
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
     protected function driverRead(CacheItemInterface $item)
106 106
     {
107 107
         $document = $this->getCollection()
108
-          ->findOne(['_id' => $item->getKey()],
108
+            ->findOne(['_id' => $item->getKey()],
109 109
             [self::DRIVER_DATA_WRAPPER_INDEX, self::DRIVER_TIME_WRAPPER_INDEX, self::DRIVER_TAGS_WRAPPER_INDEX  /*'d', 'e'*/]);
110 110
 
111 111
         if ($document) {
112 112
             return [
113
-              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin),
114
-              self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec),
115
-              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin),
113
+                self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin),
114
+                self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec),
115
+                self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin),
116 116
             ];
117 117
         } else {
118 118
             return null;
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
              * @todo make an url builder
168 168
              */
169 169
             $this->instance = $this->instance ?: (new MongodbClient('mongodb://' .
170
-              ($username ?: '') .
171
-              ($password ? ":{$password}" : '') .
172
-              ($username ? '@' : '') . "{$host}" .
173
-              ($port != '27017' ? ":{$port}" : ''), ['connectTimeoutMS' => $timeout * 1000]))->phpFastCache;
170
+                ($username ?: '') .
171
+                ($password ? ":{$password}" : '') .
172
+                ($username ? '@' : '') . "{$host}" .
173
+                ($port != '27017' ? ":{$port}" : ''), ['connectTimeoutMS' => $timeout * 1000]))->phpFastCache;
174 174
             // $this->instance->Cache->createIndex([self::DRIVER_TIME_WRAPPER_INDEX => 1], ['expireAfterSeconds' => 0]);
175 175
         }
176 176
     }
@@ -196,25 +196,25 @@  discard block
 block discarded – undo
196 196
     public function getStats()
197 197
     {
198 198
         $serverStatus = $this->getCollection()->db->command([
199
-          'serverStatus' => 1,
200
-          'recordStats' => 0,
201
-          'repl' => 0,
202
-          'metrics' => 0,
199
+            'serverStatus' => 1,
200
+            'recordStats' => 0,
201
+            'repl' => 0,
202
+            'metrics' => 0,
203 203
         ]);
204 204
 
205 205
         $collStats = $this->getCollection()->db->command([
206
-          'collStats' => 'Cache',
207
-          'verbose' => true,
206
+            'collStats' => 'Cache',
207
+            'verbose' => true,
208 208
         ]);
209 209
 
210 210
         $stats = (new driverStatistic())
211
-          ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.")
212
-          ->setSize((int) @$collStats[ 'size' ])
213
-          ->setData(implode(', ', array_keys($this->itemInstances)))
214
-          ->setRawData([
211
+            ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.")
212
+            ->setSize((int) @$collStats[ 'size' ])
213
+            ->setData(implode(', ', array_keys($this->itemInstances)))
214
+            ->setRawData([
215 215
             'serverStatus' => $serverStatus,
216 216
             'collStats' => $collStats,
217
-          ]);
217
+            ]);
218 218
 
219 219
         return $stats;
220 220
     }
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
 namespace phpFastCache\Drivers\Wincache;
16 16
 
17 17
 use phpFastCache\Core\DriverAbstract;
18
-use phpFastCache\Core\StandardPsr6StructureTrait;
19 18
 use phpFastCache\Entities\driverStatistic;
20 19
 use phpFastCache\Exceptions\phpFastCacheDriverCheckException;
21 20
 use phpFastCache\Exceptions\phpFastCacheDriverException;
Please login to merge, or discard this patch.