Completed
Push — final ( d7128a...050796 )
by Georges
9s
created
src/phpFastCache/Core/ExtendedCacheItemPoolTrait.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -334,7 +334,7 @@
 block discarded – undo
334 334
 
335 335
     /**
336 336
      * @internal This method de-register an item from $this->itemInstances
337
-     * @param CacheItemInterface|string $item
337
+     * @param CacheItemInterface $item
338 338
      * @throws \InvalidArgumentException
339 339
      */
340 340
     protected function deregisterItem($item)
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function getItemsAsJsonString(array $keys = [], $option = 0, $depth = 512)
49 49
     {
50
-        $callback = function(CacheItemInterface $item){
50
+        $callback = function(CacheItemInterface $item) {
51 51
             return $item->get();
52 52
         };
53 53
         return json_encode(array_map($callback, array_values($this->getItems($keys))), $option, $depth);
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
                  *
76 76
                  * #headache
77 77
                  */
78
-                return array_filter($this->getItems(array_unique(array_keys($items))), function(ExtendedCacheItemInterface $item){
78
+                return array_filter($this->getItems(array_unique(array_keys($items))), function(ExtendedCacheItemInterface $item) {
79 79
                     return $item->isHit();
80 80
                 });
81 81
             } else {
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     public function getItemsByTagsAsJsonString(array $tagNames, $option = 0, $depth = 512)
119 119
     {
120
-        $callback = function(CacheItemInterface $item){
120
+        $callback = function(CacheItemInterface $item) {
121 121
             return $item->get();
122 122
         };
123 123
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
      */
303 303
     public function detachItem(CacheItemInterface $item)
304 304
     {
305
-        if(isset($this->itemInstances[$item->getKey()])){
305
+        if (isset($this->itemInstances[$item->getKey()])) {
306 306
             $this->deregisterItem($item);
307 307
         }
308 308
     }
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
      */
325 325
     public function attachItem(CacheItemInterface $item)
326 326
     {
327
-        if(isset($this->itemInstances[$item->getKey()]) && spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
327
+        if (isset($this->itemInstances[$item->getKey()]) && spl_object_hash($item) !== spl_object_hash($this->itemInstances[$item->getKey()])) {
328 328
             throw new \LogicException('The item already exists and cannot be overwritten because the Spl object hash mismatches ! You probably tried to re-attach a detached item which has been already retrieved from cache.');
329
-        }else{
329
+        } else {
330 330
             $this->itemInstances[$item->getKey()] = $item;
331 331
         }
332 332
     }
@@ -339,15 +339,15 @@  discard block
 block discarded – undo
339 339
      */
340 340
     protected function deregisterItem($item)
341 341
     {
342
-        if($item instanceof CacheItemInterface){
343
-            unset($this->itemInstances[ $item->getKey() ]);
342
+        if ($item instanceof CacheItemInterface) {
343
+            unset($this->itemInstances[$item->getKey()]);
344 344
 
345
-        }else if(is_string($item)){
346
-            unset($this->itemInstances[ $item ]);
347
-        }else{
345
+        } else if (is_string($item)) {
346
+            unset($this->itemInstances[$item]);
347
+        } else {
348 348
             throw new \InvalidArgumentException('Invalid type for $item variable');
349 349
         }
350
-        if(gc_enabled()){
350
+        if (gc_enabled()) {
351 351
             gc_collect_cycles();
352 352
         }
353 353
     }
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
      */
364 364
     public function isAttached(CacheItemInterface $item)
365 365
     {
366
-        if(isset($this->itemInstances[$item->getKey()])){
367
-            return spl_object_hash($item) === spl_object_hash($this->itemInstances[ $item->getKey() ]);
366
+        if (isset($this->itemInstances[$item->getKey()])) {
367
+            return spl_object_hash($item) === spl_object_hash($this->itemInstances[$item->getKey()]);
368 368
         }
369 369
         return null;
370 370
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
     {
327 327
         if(isset($this->itemInstances[$item->getKey()]) && spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
328 328
             throw new \LogicException('The item already exists and cannot be overwritten because the Spl object hash mismatches ! You probably tried to re-attach a detached item which has been already retrieved from cache.');
329
-        }else{
329
+        } else{
330 330
             $this->itemInstances[$item->getKey()] = $item;
331 331
         }
332 332
     }
@@ -342,9 +342,9 @@  discard block
 block discarded – undo
342 342
         if($item instanceof CacheItemInterface){
343 343
             unset($this->itemInstances[ $item->getKey() ]);
344 344
 
345
-        }else if(is_string($item)){
345
+        } else if(is_string($item)){
346 346
             unset($this->itemInstances[ $item ]);
347
-        }else{
347
+        } else{
348 348
             throw new \InvalidArgumentException('Invalid type for $item variable');
349 349
         }
350 350
         if(gc_enabled()){
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Predis/Driver.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -127,14 +127,14 @@  discard block
 block discarded – undo
127 127
     protected function driverConnect()
128 128
     {
129 129
         $server = isset($this->config[ 'redis' ]) ? $this->config[ 'redis' ] : [
130
-          'host' => '127.0.0.1',
131
-          'port' => '6379',
132
-          'password' => '',
133
-          'database' => '',
130
+            'host' => '127.0.0.1',
131
+            'port' => '6379',
132
+            'password' => '',
133
+            'database' => '',
134 134
         ];
135 135
 
136 136
         $config = [
137
-          'host' => $server[ 'host' ],
137
+            'host' => $server[ 'host' ],
138 138
         ];
139 139
 
140 140
         $port = isset($server[ 'port' ]) ? $server[ 'port' ] : '';
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
         $date = (isset($info['Server'][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info['Server'][ 'uptime_in_seconds' ]) : 'unknown date');
185 185
 
186 186
         return (new driverStatistic())
187
-          ->setData(implode(', ', array_keys($this->itemInstances)))
188
-          ->setRawData($this->instance->info())
189
-          ->setSize($size)
190
-          ->setInfo(sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", $version, $date->format(DATE_RFC2822)));
187
+            ->setData(implode(', ', array_keys($this->itemInstances)))
188
+            ->setRawData($this->instance->info())
189
+            ->setSize($size)
190
+            ->setInfo(sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", $version, $date->format(DATE_RFC2822)));
191 191
     }
192 192
 }
193 193
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      */
127 127
     protected function driverConnect()
128 128
     {
129
-        $server = isset($this->config[ 'redis' ]) ? $this->config[ 'redis' ] : [
129
+        $server = isset($this->config['redis']) ? $this->config['redis'] : [
130 130
           'host' => '127.0.0.1',
131 131
           'port' => '6379',
132 132
           'password' => '',
@@ -134,32 +134,32 @@  discard block
 block discarded – undo
134 134
         ];
135 135
 
136 136
         $config = [
137
-          'host' => $server[ 'host' ],
137
+          'host' => $server['host'],
138 138
         ];
139 139
 
140
-        $port = isset($server[ 'port' ]) ? $server[ 'port' ] : '';
140
+        $port = isset($server['port']) ? $server['port'] : '';
141 141
         if ($port != '') {
142
-            $config[ 'port' ] = $port;
142
+            $config['port'] = $port;
143 143
         }
144 144
 
145
-        $password = isset($server[ 'password' ]) ? $server[ 'password' ] : '';
145
+        $password = isset($server['password']) ? $server['password'] : '';
146 146
         if ($password != '') {
147
-            $config[ 'password' ] = $password;
147
+            $config['password'] = $password;
148 148
         }
149 149
 
150
-        $database = isset($server[ 'database' ]) ? $server[ 'database' ] : '';
150
+        $database = isset($server['database']) ? $server['database'] : '';
151 151
         if ($database != '') {
152
-            $config[ 'database' ] = $database;
152
+            $config['database'] = $database;
153 153
         }
154 154
 
155
-        $timeout = isset($server[ 'timeout' ]) ? $server[ 'timeout' ] : '';
155
+        $timeout = isset($server['timeout']) ? $server['timeout'] : '';
156 156
         if ($timeout != '') {
157
-            $config[ 'timeout' ] = $timeout;
157
+            $config['timeout'] = $timeout;
158 158
         }
159 159
 
160
-        $read_write_timeout = isset($server[ 'read_write_timeout' ]) ? $server[ 'read_write_timeout' ] : '';
160
+        $read_write_timeout = isset($server['read_write_timeout']) ? $server['read_write_timeout'] : '';
161 161
         if ($read_write_timeout != '') {
162
-            $config[ 'read_write_timeout' ] = $read_write_timeout;
162
+            $config['read_write_timeout'] = $read_write_timeout;
163 163
         }
164 164
 
165 165
         $this->instance = new PredisClient($config);
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         $info = $this->instance->info();
182 182
         $size = (isset($info['Memory']['used_memory']) ? $info['Memory']['used_memory'] : 0);
183 183
         $version = (isset($info['Server']['redis_version']) ? $info['Server']['redis_version'] : 0);
184
-        $date = (isset($info['Server'][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info['Server'][ 'uptime_in_seconds' ]) : 'unknown date');
184
+        $date = (isset($info['Server']['uptime_in_seconds']) ? (new \DateTime())->setTimestamp(time() - $info['Server']['uptime_in_seconds']) : 'unknown date');
185 185
 
186 186
         return (new driverStatistic())
187 187
           ->setData(implode(', ', array_keys($this->itemInstances)))
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Devtrue/Driver.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
     protected function driverRead(CacheItemInterface $item)
80 80
     {
81 81
         return [
82
-          self::DRIVER_DATA_WRAPPER_INDEX => true,
83
-          self::DRIVER_TAGS_WRAPPER_INDEX => [],
84
-          self::DRIVER_TIME_WRAPPER_INDEX => new \DateTime(),
82
+            self::DRIVER_DATA_WRAPPER_INDEX => true,
83
+            self::DRIVER_TAGS_WRAPPER_INDEX => [],
84
+            self::DRIVER_TIME_WRAPPER_INDEX => new \DateTime(),
85 85
         ];
86 86
     }
87 87
 
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
     {
132 132
         $stat = new driverStatistic();
133 133
         $stat->setInfo('[Devtrue] A void info string')
134
-          ->setSize(0)
135
-          ->setData(implode(', ', array_keys($this->itemInstances)))
136
-          ->setRawData(true);
134
+            ->setSize(0)
135
+            ->setData(implode(', ', array_keys($this->itemInstances)))
136
+            ->setRawData(true);
137 137
 
138 138
         return $stat;
139 139
     }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Devfalse/Driver.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
     protected function driverRead(CacheItemInterface $item)
80 80
     {
81 81
         return [
82
-          self::DRIVER_DATA_WRAPPER_INDEX => false,
83
-          self::DRIVER_TAGS_WRAPPER_INDEX => [],
84
-          self::DRIVER_TIME_WRAPPER_INDEX => new \DateTime(),
82
+            self::DRIVER_DATA_WRAPPER_INDEX => false,
83
+            self::DRIVER_TAGS_WRAPPER_INDEX => [],
84
+            self::DRIVER_TIME_WRAPPER_INDEX => new \DateTime(),
85 85
         ];
86 86
     }
87 87
     /**
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
     {
131 131
         $stat = new driverStatistic();
132 132
         $stat->setInfo('[Devfalse] A void info string')
133
-          ->setSize(0)
134
-          ->setData(implode(', ', array_keys($this->itemInstances)))
135
-          ->setRawData(false);
133
+            ->setSize(0)
134
+            ->setData(implode(', ', array_keys($this->itemInstances)))
135
+            ->setRawData(false);
136 136
 
137 137
         return $stat;
138 138
     }
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
@@ -130,8 +130,8 @@
 block discarded – undo
130 130
      */
131 131
     public function getStats()
132 132
     {
133
-        if(function_exists('zend_shm_cache_info')) {
134
-            $stats = (array)zend_shm_cache_info();
133
+        if (function_exists('zend_shm_cache_info')) {
134
+            $stats = (array) zend_shm_cache_info();
135 135
             return (new driverStatistic())
136 136
                 ->setData(implode(', ', array_keys($this->namespaces)))
137 137
                 ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats['items_total']))
Please login to merge, or discard this patch.