@@ -132,9 +132,9 @@ |
||
132 | 132 | $date = (new \DateTime())->setTimestamp(time() - $info[ 'total_cache_uptime' ]); |
133 | 133 | |
134 | 134 | return (new driverStatistic()) |
135 | - ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
|
136 | - ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ]) |
|
137 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
138 | - ->setRawData($memInfo); |
|
135 | + ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
|
136 | + ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ]) |
|
137 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
138 | + ->setRawData($memInfo); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | \ No newline at end of file |
@@ -129,11 +129,11 @@ |
||
129 | 129 | { |
130 | 130 | $memInfo = wincache_ucache_meminfo(); |
131 | 131 | $info = wincache_ucache_info(); |
132 | - $date = (new \DateTime())->setTimestamp(time() - $info[ 'total_cache_uptime' ]); |
|
132 | + $date = (new \DateTime())->setTimestamp(time() - $info['total_cache_uptime']); |
|
133 | 133 | |
134 | 134 | return (new driverStatistic()) |
135 | 135 | ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
136 | - ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ]) |
|
136 | + ->setSize($memInfo['memory_free'] - $memInfo['memory_total']) |
|
137 | 137 | ->setData(implode(', ', array_keys($this->itemInstances))) |
138 | 138 | ->setRawData($memInfo); |
139 | 139 | } |
@@ -136,10 +136,10 @@ |
||
136 | 136 | $info = xcache_info(XC_TYPE_VAR, 0); |
137 | 137 | |
138 | 138 | return (new driverStatistic()) |
139 | - ->setSize(abs($info[ 'size' ] - $info[ 'avail' ])) |
|
140 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
141 | - ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES))) |
|
142 | - ->setRawData($info); |
|
139 | + ->setSize(abs($info[ 'size' ] - $info[ 'avail' ])) |
|
140 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
141 | + ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES))) |
|
142 | + ->setRawData($info); |
|
143 | 143 | } else { |
144 | 144 | throw new \RuntimeException("PhpFastCache is not able to read Xcache configuration. Please put this to your php.ini:\n |
145 | 145 | [xcache.admin] |
@@ -136,7 +136,7 @@ |
||
136 | 136 | $info = xcache_info(XC_TYPE_VAR, 0); |
137 | 137 | |
138 | 138 | return (new driverStatistic()) |
139 | - ->setSize(abs($info[ 'size' ] - $info[ 'avail' ])) |
|
139 | + ->setSize(abs($info['size'] - $info['avail'])) |
|
140 | 140 | ->setData(implode(', ', array_keys($this->itemInstances))) |
141 | 141 | ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES))) |
142 | 142 | ->setRawData($info); |
@@ -136,10 +136,10 @@ |
||
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 |
@@ -133,13 +133,13 @@ |
||
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 |
@@ -131,7 +131,7 @@ discard block |
||
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 |
||
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 |
@@ -52,7 +52,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -139,10 +139,10 @@ discard block |
||
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 |
||
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 | } |
@@ -138,17 +138,17 @@ discard block |
||
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 |
||
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()); |
@@ -131,7 +131,7 @@ discard block |
||
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 |
||
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 |
@@ -127,7 +127,7 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -74,9 +74,9 @@ |
||
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 | } |
@@ -273,7 +273,7 @@ |
||
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 |
@@ -95,13 +95,13 @@ discard block |
||
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 |
||
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 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | /** |
226 | 226 | * @param $name string|array |
227 | - * @param mixed $value |
|
227 | + * @param string $value |
|
228 | 228 | * @throws \InvalidArgumentException |
229 | 229 | */ |
230 | 230 | public static function setDefaultConfig($name, $value = null) |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
242 | - * @return array |
|
242 | + * @return ExtendedCacheItemPoolInterface[] |
|
243 | 243 | */ |
244 | 244 | public static function getDefaultConfig() |
245 | 245 | { |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | } |
248 | 248 | |
249 | 249 | /** |
250 | - * @return array |
|
250 | + * @return string[] |
|
251 | 251 | */ |
252 | 252 | public static function getStaticSystemDrivers() |
253 | 253 | { |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | } |
272 | 272 | |
273 | 273 | /** |
274 | - * @return array |
|
274 | + * @return string[] |
|
275 | 275 | */ |
276 | 276 | public static function getStaticAllDrivers() |
277 | 277 | { |
@@ -56,15 +56,15 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -56,18 +56,18 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * Register Autoload |
20 | 20 | */ |
21 | -spl_autoload_register(function ($entity) { |
|
21 | +spl_autoload_register(function($entity) { |
|
22 | 22 | $module = explode('\\', $entity, 2); |
23 | - if (!in_array($module[ 0 ], ['phpFastCache', 'Psr'])) { |
|
23 | + if (!in_array($module[0], ['phpFastCache', 'Psr'])) { |
|
24 | 24 | /** |
25 | 25 | * Not a part of phpFastCache file |
26 | 26 | * then we return here. |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | if (is_readable($path)) { |
34 | 34 | require_once $path; |
35 | - }else{ |
|
35 | + } else { |
|
36 | 36 | trigger_error('Cannot locate the Psr/Cache files', E_USER_ERROR); |
37 | 37 | return; |
38 | 38 | } |
@@ -273,7 +273,7 @@ |
||
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 |
@@ -46,6 +46,6 @@ |
||
46 | 46 | }); |
47 | 47 | |
48 | 48 | if ((!defined('PFC_IGNORE_COMPOSER_WARNING') || !PFC_IGNORE_COMPOSER_WARNING) && class_exists('Composer\Autoload\ClassLoader')) { |
49 | - trigger_error('Your project already makes use of Composer. You SHOULD use the composer dependency "phpfastcache/phpfastcache" instead of hard-autoloading.', |
|
49 | + trigger_error('Your project already makes use of Composer. You SHOULD use the composer dependency "phpfastcache/phpfastcache" instead of hard-autoloading.', |
|
50 | 50 | E_USER_WARNING); |
51 | 51 | } |
52 | 52 | \ No newline at end of file |