Completed
Push — v5 ( e64925...6b59f3 )
by Georges
02:51
created
src/phpFastCache/Drivers/Ssdb/Driver.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -137,18 +137,18 @@  discard block
 block discarded – undo
137 137
      */
138 138
     protected function driverConnect()
139 139
     {
140
-        try{
141
-            $server = isset($this->config[ 'ssdb' ]) ? $this->config[ 'ssdb' ] : [
140
+        try {
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);
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
             } else {
160 160
                 return true;
161 161
             }
162
-        }catch(SSDBException $e){
163
-            throw new phpFastCacheDriverCheckException('Ssdb failed to connect with error: '. $e->getMessage(), 0 , $e);
162
+        } catch (SSDBException $e) {
163
+            throw new phpFastCacheDriverCheckException('Ssdb failed to connect with error: ' . $e->getMessage(), 0, $e);
164 164
         }
165 165
     }
166 166
 
Please login to merge, or discard this patch.
src/phpFastCache/CacheManager.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
      * @var array
53 53
      */
54 54
     public static $config = [
55
-      'default_chmod' => 0777, // 0777 recommended
56
-      'fallback' => 'files', //Fall back when old driver is not support
57
-      'securityKey' => 'auto',
58
-      'htaccess' => true,
59
-      'path' => '',// if not set will be the value of sys_get_temp_dir()
60
-      "limited_memory_each_object" => 4096, // maximum size (bytes) of object store in memory
61
-      "compress_data" => false, // compress stored data, if the backend supports it
55
+        'default_chmod' => 0777, // 0777 recommended
56
+        'fallback' => 'files', //Fall back when old driver is not support
57
+        'securityKey' => 'auto',
58
+        'htaccess' => true,
59
+        'path' => '',// if not set will be the value of sys_get_temp_dir()
60
+        "limited_memory_each_object" => 4096, // maximum size (bytes) of object store in memory
61
+        "compress_data" => false, // compress stored data, if the backend supports it
62 62
     ];
63 63
 
64 64
     /**
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             $class = self::getNamespacePath() . $driver . '\Driver';
93 93
             self::$instances[ $instance ] = new $class($config);
94 94
         } else if(++$badPracticeOmeter[$driver] >= 5){
95
-           trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
95
+            trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
96 96
            See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F');
97 97
         }
98 98
 
@@ -181,21 +181,21 @@  discard block
 block discarded – undo
181 181
     public static function getStaticSystemDrivers()
182 182
     {
183 183
         return [
184
-          'Sqlite',
185
-          'Files',
186
-          'Apc',
187
-          'Apcu',
188
-          'Memcache',
189
-          'Memcached',
190
-          'Couchbase',
191
-          'Mongodb',
192
-          'Predis',
193
-          'Redis',
194
-          'Ssdb',
195
-          'Leveldb',
196
-          'Wincache',
197
-          'Xcache',
198
-          'Devnull',
184
+            'Sqlite',
185
+            'Files',
186
+            'Apc',
187
+            'Apcu',
188
+            'Memcache',
189
+            'Memcached',
190
+            'Couchbase',
191
+            'Mongodb',
192
+            'Predis',
193
+            'Redis',
194
+            'Ssdb',
195
+            'Leveldb',
196
+            'Wincache',
197
+            'Xcache',
198
+            'Devnull',
199 199
         ];
200 200
     }
201 201
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
       'fallback' => 'files', //Fall back when old driver is not support
57 57
       'securityKey' => 'auto',
58 58
       'htaccess' => true,
59
-      'path' => '',// if not set will be the value of sys_get_temp_dir()
59
+      'path' => '', // if not set will be the value of sys_get_temp_dir()
60 60
       "limited_memory_each_object" => 4096, // maximum size (bytes) of object store in memory
61 61
       "compress_data" => false, // compress stored data, if the backend supports it
62 62
     ];
@@ -87,16 +87,16 @@  discard block
 block discarded – undo
87 87
         }
88 88
 
89 89
         $instance = crc32($driver . serialize($config));
90
-        if (!isset(self::$instances[ $instance ])) {
90
+        if (!isset(self::$instances[$instance])) {
91 91
             $badPracticeOmeter[$driver] = 1;
92 92
             $class = self::getNamespacePath() . $driver . '\Driver';
93
-            self::$instances[ $instance ] = new $class($config);
94
-        } else if(++$badPracticeOmeter[$driver] >= 5){
93
+            self::$instances[$instance] = new $class($config);
94
+        } else if (++$badPracticeOmeter[$driver] >= 5) {
95 95
            trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
96 96
            See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F');
97 97
         }
98 98
 
99
-        return self::$instances[ $instance ];
99
+        return self::$instances[$instance];
100 100
     }
101 101
 
102 102
     /**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      */
130 130
     public static function __callStatic($name, $arguments)
131 131
     {
132
-        $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[ 0 ] : []);
132
+        $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[0] : []);
133 133
 
134 134
         return self::getInstance($name, $options);
135 135
     }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         if (is_array($name)) {
172 172
             self::$config = array_merge(self::$config, $name);
173 173
         } else {
174
-            self::$config[ $name ] = $value;
174
+            self::$config[$name] = $value;
175 175
         }
176 176
     }
177 177
 
Please login to merge, or discard this patch.
tests/Psr6InterfaceImplements.test.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@
 block discarded – undo
23 23
 if (!is_object($driverInstance)) {
24 24
     echo '[FAIL] CacheManager::getInstance() returned an invalid variable type:' . gettype($driverInstance) . "\n";
25 25
     $status = 1;
26
-}else if(!($driverInstance instanceof CacheItemPoolInterface)){
26
+} else if (!($driverInstance instanceof CacheItemPoolInterface)) {
27 27
     echo '[FAIL] CacheManager::getInstance() returned an invalid class:' . get_class($driverInstance) . "\n";
28 28
     $status = 1;
29
-}else{
29
+} else {
30 30
     echo '[PASS] CacheManager::getInstance() returned a valid CacheItemPoolInterface object: ' . get_class($driverInstance) . "\n";
31 31
 }
32 32
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@
 block discarded – undo
23 23
 if (!is_object($driverInstance)) {
24 24
     echo '[FAIL] CacheManager::getInstance() returned an invalid variable type:' . gettype($driverInstance) . "\n";
25 25
     $status = 1;
26
-}else if(!($driverInstance instanceof CacheItemPoolInterface)){
26
+} else if(!($driverInstance instanceof CacheItemPoolInterface)){
27 27
     echo '[FAIL] CacheManager::getInstance() returned an invalid class:' . get_class($driverInstance) . "\n";
28 28
     $status = 1;
29
-}else{
29
+} else{
30 30
     echo '[PASS] CacheManager::getInstance() returned a valid CacheItemPoolInterface object: ' . get_class($driverInstance) . "\n";
31 31
 }
32 32
 
Please login to merge, or discard this patch.