Completed
Push — v5 ( 7eac3b...4c4174 )
by Georges
02:37
created
src/phpFastCache/Core/MemcacheDriverCollisionDetectorTrait.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
                 return true;
28 28
             } else if (constant($CONSTANT_NAME) !== $driverName) {
29 29
                 trigger_error('Memcache collision detected, you used both Memcache and Memcached driver in your script, this may leads to unexpected behaviours',
30
-                  E_USER_WARNING);
30
+                    E_USER_WARNING);
31 31
 
32 32
                 return false;
33 33
             }
Please login to merge, or discard this patch.
src/phpFastCache/Cache/ItemBaseTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
     public function removeTag($tagName)
350 350
     {
351 351
         if (($key = array_search($tagName, $this->tags)) !== false) {
352
-            unset($this->tags[ $key ]);
352
+            unset($this->tags[$key]);
353 353
             $this->removedTags[] = $tagName;
354 354
         }
355 355
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
     final public function __debugInfo()
393 393
     {
394 394
         $info = get_object_vars($this);
395
-        $info[ 'driver' ] = 'object(' . get_class($info[ 'driver' ]) . ')';
395
+        $info['driver'] = 'object(' . get_class($info['driver']) . ')';
396 396
 
397 397
         return (array) $info;
398 398
     }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Predis/Driver.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -127,14 +127,14 @@
 block discarded – undo
127 127
     public 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' ] : '';
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      */
127 127
     public 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);
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Memcache/Driver.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@
 block discarded – undo
133 133
         $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []);
134 134
         if (count($servers) < 1) {
135 135
             $servers = [
136
-              ['127.0.0.1', 11211],
136
+                ['127.0.0.1', 11211],
137 137
             ];
138 138
         }
139 139
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 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
         }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function driverConnect()
132 132
     {
133
-        $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []);
133
+        $servers = (!empty($this->config['memcache']) && is_array($this->config['memcache']) ? $this->config['memcache'] : []);
134 134
         if (count($servers) < 1) {
135 135
             $servers = [
136 136
               ['127.0.0.1', 11211],
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
         foreach ($servers as $server) {
141 141
             try {
142
-                if (!$this->instance->addserver($server[ 0 ], $server[ 1 ])) {
142
+                if (!$this->instance->addserver($server[0], $server[1])) {
143 143
                     $this->fallback = true;
144 144
                 }
145 145
             } catch (\Exception $e) {
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Redis/Driver.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -122,11 +122,11 @@
 block discarded – undo
122 122
         } else {
123 123
             $this->instance = $this->instance ?: new RedisClient();
124 124
 
125
-            $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1';
126
-            $port = isset($this->config[ 'port' ]) ? (int) $this->config[ 'port' ] : '6379';
127
-            $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
128
-            $database = isset($this->config[ 'database' ]) ? $this->config[ 'database' ] : '';
129
-            $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : '';
125
+            $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1';
126
+            $port = isset($this->config['port']) ? (int) $this->config['port'] : '6379';
127
+            $password = isset($this->config['password']) ? $this->config['password'] : '';
128
+            $database = isset($this->config['database']) ? $this->config['database'] : '';
129
+            $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : '';
130 130
 
131 131
             if (!$this->instance->connect($host, (int) $port, (int) $timeout)) {
132 132
                 return false;
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Cookie/Item.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
             $this->driver->setItem($this);
43 43
         } else {
44 44
             throw new \InvalidArgumentException(sprintf('$key must be a string, got type "%s" instead.',
45
-              gettype($key)));
45
+                gettype($key)));
46 46
         }
47 47
     }
48 48
 
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Cookie/Driver.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             $keyword = self::PREFIX . $item->getKey();
80 80
             $v = json_encode($this->driverPreWrap($item));
81 81
 
82
-            if (isset($this->config[ 'limited_memory_each_object' ]) && strlen($v) > $this->config[ 'limited_memory_each_object' ]) {
82
+            if (isset($this->config['limited_memory_each_object']) && strlen($v) > $this->config['limited_memory_each_object']) {
83 83
                 return false;
84 84
             }
85 85
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         // return null if no caching
101 101
         // return value if in caching
102 102
         $keyword = self::PREFIX . $key;
103
-        $x = isset($_COOKIE[ $keyword ]) ? $this->decode(json_decode($_COOKIE[ $keyword ], true)) : false;
103
+        $x = isset($_COOKIE[$keyword]) ? $this->decode(json_decode($_COOKIE[$keyword], true)) : false;
104 104
 
105 105
         if ($x == false) {
106 106
             return null;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     {
122 122
         $this->driverConnect();
123 123
         $keyword = self::PREFIX . $key;
124
-        $x = isset($_COOKIE[ $keyword ]) ? $this->decode(json_decode($_COOKIE[ $keyword ])->t) : false;
124
+        $x = isset($_COOKIE[$keyword]) ? $this->decode(json_decode($_COOKIE[$keyword])->t) : false;
125 125
 
126 126
         return $x ? $x - time() : $x;
127 127
     }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         if ($item instanceof Item) {
140 140
             $this->driverConnect();
141 141
             $keyword = self::PREFIX . $item->getKey();
142
-            $_COOKIE[ $keyword ] = null;
142
+            $_COOKIE[$keyword] = null;
143 143
 
144 144
             return @setcookie($keyword, null, -10);
145 145
         } else {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         $this->driverConnect();
157 157
         foreach ($_COOKIE as $keyword => $value) {
158 158
             if (strpos($keyword, self::PREFIX) !== false) {
159
-                $_COOKIE[ $keyword ] = null;
159
+                $_COOKIE[$keyword] = null;
160 160
                 $result = @setcookie($keyword, null, -10);
161 161
                 if ($return !== false) {
162 162
                     $return = $result;
Please login to merge, or discard this patch.
src/phpFastCache/CacheManager.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -47,22 +47,22 @@  discard block
 block discarded – undo
47 47
      * @var array
48 48
      */
49 49
     public static $config = [
50
-      'default_chmod' => 0777, // 0777 , 0666, 0644
50
+        'default_chmod' => 0777, // 0777 , 0666, 0644
51 51
 
52
-      'overwrite' => "", // files, sqlite, etc it will overwrite ur storage and all other caching for waiting u fix ur server
53
-      'allow_search' => false, // turn to true will allow $method search("/regex/")
52
+        'overwrite' => "", // files, sqlite, etc it will overwrite ur storage and all other caching for waiting u fix ur server
53
+        'allow_search' => false, // turn to true will allow $method search("/regex/")
54 54
 
55
-      'fallback' => 'files', //Fall back when old driver is not support
55
+        'fallback' => 'files', //Fall back when old driver is not support
56 56
 
57
-      'securityKey' => 'auto',
58
-      'htaccess' => true,
59
-      'path' => '',
57
+        'securityKey' => 'auto',
58
+        'htaccess' => true,
59
+        'path' => '',
60 60
 
61 61
 
62
-      'extensions' => [],
63
-      "cache_method" => 2, // 1 = normal, 2 = phpfastcache, 3 = memory
64
-      "limited_memory_each_object" => 4000, // maximum size (bytes) of object store in memory
65
-      "compress_data" => false, // compress stored data, if the backend supports it
62
+        'extensions' => [],
63
+        "cache_method" => 2, // 1 = normal, 2 = phpfastcache, 3 = memory
64
+        "limited_memory_each_object" => 4000, // maximum size (bytes) of object store in memory
65
+        "compress_data" => false, // compress stored data, if the backend supports it
66 66
     ];
67 67
 
68 68
     /**
@@ -107,21 +107,21 @@  discard block
 block discarded – undo
107 107
     {
108 108
         static $autoDriver;
109 109
         $systemDrivers = [
110
-          'Sqlite',
111
-          'Files',
112
-          'Apc',
113
-          'Apcu',
114
-          'Memcache',
115
-          'Memcached',
116
-          'Couchbase',
117
-          'Mongodb',
118
-          'Predis',
119
-          'Redis',
120
-          'Ssdb',
121
-          'Leveldb',
122
-          'Wincache',
123
-          'Xcache',
124
-          'Devnull',
110
+            'Sqlite',
111
+            'Files',
112
+            'Apc',
113
+            'Apcu',
114
+            'Memcache',
115
+            'Memcached',
116
+            'Couchbase',
117
+            'Mongodb',
118
+            'Predis',
119
+            'Redis',
120
+            'Ssdb',
121
+            'Leveldb',
122
+            'Wincache',
123
+            'Xcache',
124
+            'Devnull',
125 125
         ];
126 126
 
127 127
         if ($autoDriver === null) {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -87,15 +87,15 @@  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
             $class = self::getNamespacePath() . $driver . '\Driver';
92
-            self::$instances[ $instance ] = new $class($config);
92
+            self::$instances[$instance] = new $class($config);
93 93
         } else {
94 94
             trigger_error('Calling CacheManager::getInstance for already instanced drivers is a bad practice and have a significant impact on performances.
95 95
             See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F');
96 96
         }
97 97
 
98
-        return self::$instances[ $instance ];
98
+        return self::$instances[$instance];
99 99
     }
100 100
 
101 101
     /**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     public static function __callStatic($name, $arguments)
147 147
     {
148
-        $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[ 0 ] : []);
148
+        $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[0] : []);
149 149
 
150 150
         return self::getInstance($name, $options);
151 151
     }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         if (is_array($name)) {
188 188
             self::$config = array_merge(self::$config, $name);
189 189
         } else {
190
-            self::$config[ $name ] = $value;
190
+            self::$config[$name] = $value;
191 191
         }
192 192
     }
193 193
 }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Leveldb/Driver.php 1 patch
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.