Completed
Push — V6 ( cedae3...e8e57f )
by Georges
02:16
created
src/phpFastCache/Drivers/Apc/Driver.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -136,10 +136,10 @@
 block discarded – undo
136 136
         $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]);
137 137
 
138 138
         return (new driverStatistic())
139
-          ->setData(implode(', ', array_keys($this->itemInstances)))
140
-          ->setInfo(sprintf("The APC cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822),
139
+            ->setData(implode(', ', array_keys($this->itemInstances)))
140
+            ->setInfo(sprintf("The APC cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822),
141 141
             $stats[ 'num_entries' ]))
142
-          ->setRawData($stats)
143
-          ->setSize($stats[ 'mem_size' ]);
142
+            ->setRawData($stats)
143
+            ->setSize($stats[ 'mem_size' ]);
144 144
     }
145 145
 }
146 146
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -133,13 +133,13 @@
 block discarded – undo
133 133
     public function getStats()
134 134
     {
135 135
         $stats = (array) apc_cache_info('user');
136
-        $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]);
136
+        $date = (new \DateTime())->setTimestamp($stats['start_time']);
137 137
 
138 138
         return (new driverStatistic())
139 139
           ->setData(implode(', ', array_keys($this->itemInstances)))
140 140
           ->setInfo(sprintf("The APC cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822),
141
-            $stats[ 'num_entries' ]))
141
+            $stats['num_entries']))
142 142
           ->setRawData($stats)
143
-          ->setSize($stats[ 'mem_size' ]);
143
+          ->setSize($stats['mem_size']);
144 144
     }
145 145
 }
146 146
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Memcache/Driver.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []);
132 132
         if (count($servers) < 1) {
133 133
             $servers = [
134
-              ['127.0.0.1', 11211],
134
+                ['127.0.0.1', 11211],
135 135
             ];
136 136
         }
137 137
 
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
         $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]);
162 162
 
163 163
         return (new driverStatistic())
164
-          ->setData(implode(', ', array_keys($this->itemInstances)))
165
-          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
166
-          ->setRawData($stats)
167
-          ->setSize($stats[ 'bytes' ]);
164
+            ->setData(implode(', ', array_keys($this->itemInstances)))
165
+            ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
166
+            ->setRawData($stats)
167
+            ->setSize($stats[ 'bytes' ]);
168 168
     }
169 169
 }
170 170
\ No newline at end of file
Please login to merge, or discard this patch.
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.
src/phpFastCache/Drivers/Ssdb/Driver.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
     {
140 140
         try {
141 141
             $server = isset($this->config[ 'ssdb' ]) ? $this->config[ 'ssdb' ] : [
142
-              'host' => "127.0.0.1",
143
-              'port' => 8888,
144
-              'password' => '',
145
-              'timeout' => 2000,
142
+                'host' => "127.0.0.1",
143
+                'port' => 8888,
144
+                'password' => '',
145
+                'timeout' => 2000,
146 146
             ];
147 147
 
148 148
             $host = $server[ 'host' ];
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
          * using hardcoded offset of pair key-value :-(
184 184
          */
185 185
         $stat->setInfo(sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[ 2 ], $info[ 6 ]))
186
-          ->setRawData($info)
187
-          ->setData(implode(', ', array_keys($this->itemInstances)))
188
-          ->setSize($this->instance->dbsize());
186
+            ->setRawData($info)
187
+            ->setData(implode(', ', array_keys($this->itemInstances)))
188
+            ->setSize($this->instance->dbsize());
189 189
 
190 190
         return $stat;
191 191
     }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -138,17 +138,17 @@  discard block
 block discarded – undo
138 138
     protected function driverConnect()
139 139
     {
140 140
         try {
141
-            $server = isset($this->config[ 'ssdb' ]) ? $this->config[ 'ssdb' ] : [
141
+            $server = isset($this->config['ssdb']) ? $this->config['ssdb'] : [
142 142
               'host' => "127.0.0.1",
143 143
               'port' => 8888,
144 144
               'password' => '',
145 145
               'timeout' => 2000,
146 146
             ];
147 147
 
148
-            $host = $server[ 'host' ];
149
-            $port = isset($server[ 'port' ]) ? (int) $server[ 'port' ] : 8888;
150
-            $password = isset($server[ 'password' ]) ? $server[ 'password' ] : '';
151
-            $timeout = !empty($server[ 'timeout' ]) ? (int) $server[ 'timeout' ] : 2000;
148
+            $host = $server['host'];
149
+            $port = isset($server['port']) ? (int) $server['port'] : 8888;
150
+            $password = isset($server['password']) ? $server['password'] : '';
151
+            $timeout = !empty($server['timeout']) ? (int) $server['timeout'] : 2000;
152 152
             $this->instance = new SimpleSSDB($host, $port, $timeout);
153 153
             if (!empty($password)) {
154 154
                 $this->instance->auth($password);
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
          * Data returned by Ssdb are very poorly formatted
183 183
          * using hardcoded offset of pair key-value :-(
184 184
          */
185
-        $stat->setInfo(sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[ 2 ], $info[ 6 ]))
185
+        $stat->setInfo(sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[2], $info[6]))
186 186
           ->setRawData($info)
187 187
           ->setData(implode(', ', array_keys($this->itemInstances)))
188 188
           ->setSize($this->instance->dbsize());
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Memcached/Driver.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []);
132 132
         if (count($servers) < 1) {
133 133
             $servers = [
134
-              ['127.0.0.1', 11211],
134
+                ['127.0.0.1', 11211],
135 135
             ];
136 136
         }
137 137
 
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
         $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]);
162 162
 
163 163
         return (new driverStatistic())
164
-          ->setData(implode(', ', array_keys($this->itemInstances)))
165
-          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
166
-          ->setRawData($stats)
167
-          ->setSize($stats[ 'bytes' ]);
164
+            ->setData(implode(', ', array_keys($this->itemInstances)))
165
+            ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
166
+            ->setRawData($stats)
167
+            ->setSize($stats[ 'bytes' ]);
168 168
     }
169 169
 }
170 170
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      */
128 128
     protected function driverConnect()
129 129
     {
130
-        $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []);
130
+        $servers = (!empty($this->config['memcache']) && is_array($this->config['memcache']) ? $this->config['memcache'] : []);
131 131
         if (count($servers) < 1) {
132 132
             $servers = [
133 133
               ['127.0.0.1', 11211],
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
 
137 137
         foreach ($servers as $server) {
138 138
             try {
139
-                if (!$this->instance->addServer($server[ 0 ], $server[ 1 ])) {
139
+                if (!$this->instance->addServer($server[0], $server[1])) {
140 140
                     $this->fallback = true;
141 141
                 }
142
-                if(!empty($server[ 'sasl_user' ]) && !empty($server[ 'sasl_password'])){
143
-                    $this->instance->setSaslAuthData($server[ 'sasl_user' ], $server[ 'sasl_password']);
142
+                if (!empty($server['sasl_user']) && !empty($server['sasl_password'])) {
143
+                    $this->instance->setSaslAuthData($server['sasl_user'], $server['sasl_password']);
144 144
                 }
145 145
             } catch (\Exception $e) {
146 146
                 $this->fallback = true;
@@ -160,16 +160,16 @@  discard block
 block discarded – undo
160 160
     public function getStats()
161 161
     {
162 162
         $stats = (array) $this->instance->getStats();
163
-        $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0);
164
-        $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : 'UnknownVersion');
165
-        $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0);
163
+        $stats['uptime'] = (isset($stats['uptime']) ? $stats['uptime'] : 0);
164
+        $stats['version'] = (isset($stats['version']) ? $stats['version'] : 'UnknownVersion');
165
+        $stats['bytes'] = (isset($stats['bytes']) ? $stats['version'] : 0);
166 166
 
167
-        $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]);
167
+        $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']);
168 168
 
169 169
         return (new driverStatistic())
170 170
           ->setData(implode(', ', array_keys($this->itemInstances)))
171
-          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
171
+          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822)))
172 172
           ->setRawData($stats)
173
-          ->setSize($stats[ 'bytes' ]);
173
+          ->setSize($stats['bytes']);
174 174
     }
175 175
 }
176 176
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Proxy/phpFastCacheAbstractProxy.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,9 +74,9 @@
 block discarded – undo
74 74
      */
75 75
     public function __call($name, $args)
76 76
     {
77
-        if(method_exists($this->instance, $name)){
77
+        if (method_exists($this->instance, $name)) {
78 78
             return call_user_func_array([$this->instance, $name], $args);
79
-        }else{
79
+        } else {
80 80
             throw new \BadMethodCallException(sprintf('Method %s does not exists', $name));
81 81
         }
82 82
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -273,7 +273,7 @@
 block discarded – undo
273 273
         
274 274
         if (!is_dir($path)) {
275 275
             throw new phpFastCacheDriverException("Can't read PATH:" . $path, 94);
276
-        }else{
276
+        } else{
277 277
             $size = Directory::dirSize($path);
278 278
         }
279 279
 
Please login to merge, or discard this patch.
src/phpFastCache/CacheManager.php 4 patches
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
             $class = self::getNamespacePath() . $driver . '\Driver';
96 96
             try{
97 97
                 self::$instances[ $instance ] = new $class($config);
98
-            }catch(phpFastCacheDriverCheckException $e){
98
+            } catch(phpFastCacheDriverCheckException $e){
99 99
                 $fallback = self::standardizeDriverName($config['fallback']);
100 100
                 if($fallback && $fallback !== $driver){
101 101
                     $class = self::getNamespacePath() . $fallback . '\Driver';
102 102
                     self::$instances[ $instance ] = new $class($config);
103 103
                     trigger_error(sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver, $fallback), E_USER_WARNING);
104
-                }else{
104
+                } else{
105 105
                     throw new phpFastCacheDriverCheckException($e->getMessage(), $e->getCode(), $e);
106 106
                 }
107 107
             }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
             self::$config = array_merge(self::$config, $name);
199 199
         } else if (is_string($name)){
200 200
             self::$config[ $name ] = $value;
201
-        }else{
201
+        } else{
202 202
             throw new \InvalidArgumentException('Invalid variable type: $name');
203 203
         }
204 204
     }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
      * @var ExtendedCacheItemPoolInterface[]
57 57
      */
58 58
     protected static $config = [
59
-      'itemDetailedDate' => false,// Specify if the item must provide detailed creation/modification dates
60
-      'autoTmpFallback' => false,// Automatically attempt to fallback to temporary directory if the cache fails to write on the specified directory
61
-      'secureFileManipulation' => false,// Provide a secure file manipulation mechanism, on intensive usage the performance can be affected.
62
-      'ignoreSymfonyNotice' => false,// Ignore Symfony notice for Symfony project which do not makes use of PhpFastCache's Symfony Bundle
63
-      'defaultTtl' => 900,// Default time-to-live in second
64
-      'securityKey' => 'auto',// The securityKey that will be used to create sub-directory
65
-      'htaccess' => true,// Auto-generate .htaccess if tit is missing
59
+      'itemDetailedDate' => false, // Specify if the item must provide detailed creation/modification dates
60
+      'autoTmpFallback' => false, // Automatically attempt to fallback to temporary directory if the cache fails to write on the specified directory
61
+      'secureFileManipulation' => false, // Provide a secure file manipulation mechanism, on intensive usage the performance can be affected.
62
+      'ignoreSymfonyNotice' => false, // Ignore Symfony notice for Symfony project which do not makes use of PhpFastCache's Symfony Bundle
63
+      'defaultTtl' => 900, // Default time-to-live in second
64
+      'securityKey' => 'auto', // The securityKey that will be used to create sub-directory
65
+      'htaccess' => true, // Auto-generate .htaccess if tit is missing
66 66
       'default_chmod' => 0777, // 0777 recommended
67
-      'path' => '',// if not set will be the value of sys_get_temp_dir()
67
+      'path' => '', // if not set will be the value of sys_get_temp_dir()
68 68
       'fallback' => false, //Fall back when old driver is not support
69 69
       'limited_memory_each_object' => 4096, // maximum size (bytes) of object store in memory
70 70
       'compress_data' => false, // compress stored data, if the backend supports it
@@ -100,32 +100,32 @@  discard block
 block discarded – undo
100 100
         }
101 101
 
102 102
         $instance = crc32($driver . serialize($config));
103
-        if (!isset(self::$instances[ $instance ])) {
103
+        if (!isset(self::$instances[$instance])) {
104 104
             $badPracticeOmeter[$driver] = 1;
105
-            if(!$config['ignoreSymfonyNotice'] && interface_exists('Symfony\Component\HttpKernel\KernelInterface') && !class_exists('phpFastCache\Bundle\phpFastCacheBundle')){
105
+            if (!$config['ignoreSymfonyNotice'] && interface_exists('Symfony\Component\HttpKernel\KernelInterface') && !class_exists('phpFastCache\Bundle\phpFastCacheBundle')) {
106 106
                 trigger_error('A Symfony Bundle to make the PhpFastCache integration more easier is now available here: https://github.com/PHPSocialNetwork/phpfastcache-bundle', E_USER_NOTICE);
107 107
             }
108 108
             $class = self::getNamespacePath() . $driver . '\Driver';
109
-            try{
110
-                self::$instances[ $instance ] = new $class($config);
111
-                self::$instances[ $instance ]->setEventManager(EventManager::getInstance());
112
-            }catch(phpFastCacheDriverCheckException $e){
109
+            try {
110
+                self::$instances[$instance] = new $class($config);
111
+                self::$instances[$instance]->setEventManager(EventManager::getInstance());
112
+            } catch (phpFastCacheDriverCheckException $e) {
113 113
                 $fallback = self::standardizeDriverName($config['fallback']);
114
-                if($fallback && $fallback !== $driver){
114
+                if ($fallback && $fallback !== $driver) {
115 115
                     $class = self::getNamespacePath() . $fallback . '\Driver';
116
-                    self::$instances[ $instance ] = new $class($config);
117
-                    self::$instances[ $instance ]->setEventManager(EventManager::getInstance());
116
+                    self::$instances[$instance] = new $class($config);
117
+                    self::$instances[$instance]->setEventManager(EventManager::getInstance());
118 118
                     trigger_error(sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver, $fallback), E_USER_WARNING);
119
-                }else{
119
+                } else {
120 120
                     throw new phpFastCacheDriverCheckException($e->getMessage(), $e->getCode(), $e);
121 121
                 }
122 122
             }
123
-        } else if(++$badPracticeOmeter[$driver] >= 5){
123
+        } else if (++$badPracticeOmeter[$driver] >= 5) {
124 124
            trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
125 125
            See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F');
126 126
         }
127 127
 
128
-        return self::$instances[ $instance ];
128
+        return self::$instances[$instance];
129 129
     }
130 130
 
131 131
     /**
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      */
187 187
     public static function __callStatic($name, $arguments)
188 188
     {
189
-        $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[ 0 ] : []);
189
+        $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[0] : []);
190 190
 
191 191
         return self::getInstance($name, $options);
192 192
     }
@@ -239,9 +239,9 @@  discard block
 block discarded – undo
239 239
     {
240 240
         if (is_array($name)) {
241 241
             self::$config = array_merge(self::$config, $name);
242
-        } else if (is_string($name)){
243
-            self::$config[ $name ] = $value;
244
-        }else{
242
+        } else if (is_string($name)) {
243
+            self::$config[$name] = $value;
244
+        } else {
245 245
             throw new \InvalidArgumentException('Invalid variable type: $name');
246 246
         }
247 247
     }
Please login to merge, or discard this patch.
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -56,18 +56,18 @@  discard block
 block discarded – undo
56 56
      * @var ExtendedCacheItemPoolInterface[]
57 57
      */
58 58
     protected static $config = [
59
-      'itemDetailedDate' => false,// Specify if the item must provide detailed creation/modification dates
60
-      'autoTmpFallback' => false,// Automatically attempt to fallback to temporary directory if the cache fails to write on the specified directory
61
-      'secureFileManipulation' => false,// Provide a secure file manipulation mechanism, on intensive usage the performance can be affected.
62
-      'ignoreSymfonyNotice' => false,// Ignore Symfony notice for Symfony project which do not makes use of PhpFastCache's Symfony Bundle
63
-      'defaultTtl' => 900,// Default time-to-live in second
64
-      'securityKey' => 'auto',// The securityKey that will be used to create sub-directory
65
-      'htaccess' => true,// Auto-generate .htaccess if tit is missing
66
-      'default_chmod' => 0777, // 0777 recommended
67
-      'path' => '',// if not set will be the value of sys_get_temp_dir()
68
-      'fallback' => false, //Fall back when old driver is not support
69
-      'limited_memory_each_object' => 4096, // maximum size (bytes) of object store in memory
70
-      'compress_data' => false, // compress stored data, if the backend supports it
59
+        'itemDetailedDate' => false,// Specify if the item must provide detailed creation/modification dates
60
+        'autoTmpFallback' => false,// Automatically attempt to fallback to temporary directory if the cache fails to write on the specified directory
61
+        'secureFileManipulation' => false,// Provide a secure file manipulation mechanism, on intensive usage the performance can be affected.
62
+        'ignoreSymfonyNotice' => false,// Ignore Symfony notice for Symfony project which do not makes use of PhpFastCache's Symfony Bundle
63
+        'defaultTtl' => 900,// Default time-to-live in second
64
+        'securityKey' => 'auto',// The securityKey that will be used to create sub-directory
65
+        'htaccess' => true,// Auto-generate .htaccess if tit is missing
66
+        'default_chmod' => 0777, // 0777 recommended
67
+        'path' => '',// if not set will be the value of sys_get_temp_dir()
68
+        'fallback' => false, //Fall back when old driver is not support
69
+        'limited_memory_each_object' => 4096, // maximum size (bytes) of object store in memory
70
+        'compress_data' => false, // compress stored data, if the backend supports it
71 71
     ];
72 72
 
73 73
     /**
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                 }
122 122
             }
123 123
         } else if(++$badPracticeOmeter[$driver] >= 5){
124
-           trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
124
+            trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
125 125
            See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F');
126 126
         }
127 127
 
@@ -260,22 +260,22 @@  discard block
 block discarded – undo
260 260
     public static function getStaticSystemDrivers()
261 261
     {
262 262
         return [
263
-          'Apc',
264
-          'Apcu',
265
-          'Couchbase',
266
-          'Devnull',
267
-          'Files',
268
-          'Leveldb',
269
-          'Memcache',
270
-          'Memcached',
271
-          'Memstatic',
272
-          'Mongodb',
273
-          'Predis',
274
-          'Redis',
275
-          'Ssdb',
276
-          'Sqlite',
277
-          'Wincache',
278
-          'Xcache',
263
+            'Apc',
264
+            'Apcu',
265
+            'Couchbase',
266
+            'Devnull',
267
+            'Files',
268
+            'Leveldb',
269
+            'Memcache',
270
+            'Memcached',
271
+            'Memstatic',
272
+            'Mongodb',
273
+            'Predis',
274
+            'Redis',
275
+            'Ssdb',
276
+            'Sqlite',
277
+            'Wincache',
278
+            'Xcache',
279 279
         ];
280 280
     }
281 281
 
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
     }
236 236
 
237 237
     /**
238
-     * @return array
238
+     * @return ExtendedCacheItemPoolInterface[]
239 239
      */
240 240
     public static function getDefaultConfig()
241 241
     {
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
     }
244 244
 
245 245
     /**
246
-     * @return array
246
+     * @return string[]
247 247
      */
248 248
     public static function getStaticSystemDrivers()
249 249
     {
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     }
269 269
 
270 270
     /**
271
-     * @return array
271
+     * @return string[]
272 272
      */
273 273
     public static function getStaticAllDrivers()
274 274
     {
Please login to merge, or discard this patch.
tests/Autoload.test.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 if (!class_exists('phpFastCache\CacheManager')) {
19 19
     echo "[FAIL] Autoload failed to find the CacheManager\n";
20 20
     $status = 255;
21
-}else{
21
+} else {
22 22
     echo "[PASS] Autoload successfully found the CacheManager\n";
23 23
 }
24 24
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 if (!interface_exists('Psr\Cache\CacheItemInterface')) {
29 29
     echo "[FAIL] Autoload failed to find the Psr CacheItemInterface\n";
30 30
     $status = 255;
31
-}else{
31
+} else {
32 32
     echo "[PASS] Autoload successfully found the Psr CacheItemInterface\n";
33 33
 }
34 34
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 if (!class_exists('phpFastCache\CacheManager')) {
19 19
     echo "[FAIL] Autoload failed to find the CacheManager\n";
20 20
     $status = 255;
21
-}else{
21
+} else{
22 22
     echo "[PASS] Autoload successfully found the CacheManager\n";
23 23
 }
24 24
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 if (!interface_exists('Psr\Cache\CacheItemInterface')) {
29 29
     echo "[FAIL] Autoload failed to find the Psr CacheItemInterface\n";
30 30
     $status = 255;
31
-}else{
31
+} else{
32 32
     echo "[PASS] Autoload successfully found the Psr CacheItemInterface\n";
33 33
 }
34 34
 
Please login to merge, or discard this patch.
src/phpFastCache/Core/Pool/CacheItemPoolTrait.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
     /**
159 159
      * @param \Psr\Cache\CacheItemInterface $item
160
-     * @return mixed
160
+     * @return boolean
161 161
      * @throws \InvalidArgumentException
162 162
      */
163 163
     public function save(CacheItemInterface $item)
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
     }
176 176
 
177 177
     /**
178
-     * @return mixed|null
178
+     * @return boolean
179 179
      * @throws \InvalidArgumentException
180 180
      */
181 181
     public function commit()
Please login to merge, or discard this patch.
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.
src/phpFastCache/Drivers/Devfalse/Driver.php 2 patches
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.
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.