@@ -140,9 +140,9 @@ |
||
140 | 140 | { |
141 | 141 | $stat = new DriverStatistic(); |
142 | 142 | $stat->setInfo('[Memstatic] A memory static driver') |
143 | - ->setSize(mb_strlen(serialize($this->staticStack))) |
|
144 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
145 | - ->setRawData($this->staticStack); |
|
143 | + ->setSize(mb_strlen(serialize($this->staticStack))) |
|
144 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
145 | + ->setRawData($this->staticStack); |
|
146 | 146 | |
147 | 147 | return $stat; |
148 | 148 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * Check for Cross-Driver type confusion |
69 | 69 | */ |
70 | 70 | if ($item instanceof Item) { |
71 | - return $this->staticStack[ md5($item->getKey()) ] = $this->driverPreWrap($item); |
|
71 | + return $this->staticStack[md5($item->getKey())] = $this->driverPreWrap($item); |
|
72 | 72 | } else { |
73 | 73 | throw new phpFastCacheInvalidArgumentException('Cross-Driver type confusion detected'); |
74 | 74 | } |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | protected function driverRead(CacheItemInterface $item) |
82 | 82 | { |
83 | 83 | $key = md5($item->getKey()); |
84 | - if (isset($this->staticStack[ $key ])) { |
|
85 | - return $this->staticStack[ $key ]; |
|
84 | + if (isset($this->staticStack[$key])) { |
|
85 | + return $this->staticStack[$key]; |
|
86 | 86 | } |
87 | 87 | return null; |
88 | 88 | } |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | */ |
100 | 100 | if ($item instanceof Item) { |
101 | 101 | $key = md5($item->getKey()); |
102 | - if (isset($this->staticStack[ $key ])) { |
|
103 | - unset($this->staticStack[ $key ]); |
|
102 | + if (isset($this->staticStack[$key])) { |
|
103 | + unset($this->staticStack[$key]); |
|
104 | 104 | return true; |
105 | 105 | } |
106 | 106 | return false; |
@@ -163,10 +163,10 @@ |
||
163 | 163 | $date = (new \DateTime())->setTimestamp(time() - $info[ 'uptime_in_seconds' ]); |
164 | 164 | |
165 | 165 | return (new DriverStatistic()) |
166 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
167 | - ->setRawData($info) |
|
168 | - ->setSize($info[ 'used_memory' ]) |
|
169 | - ->setInfo(sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", |
|
166 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
167 | + ->setRawData($info) |
|
168 | + ->setSize($info[ 'used_memory' ]) |
|
169 | + ->setInfo(sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", |
|
170 | 170 | $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
171 | 171 | } |
172 | 172 | } |
173 | 173 | \ No newline at end of file |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * @see https://redis.io/commands/setex |
75 | 75 | * @see https://redis.io/commands/expire |
76 | 76 | */ |
77 | - if($ttl <= 0){ |
|
77 | + if ($ttl <= 0) { |
|
78 | 78 | return $this->instance->expire($item->getKey(), 0); |
79 | - }else{ |
|
79 | + } else { |
|
80 | 80 | return $this->instance->setex($item->getKey(), $ttl, $this->encode($this->driverPreWrap($item))); |
81 | 81 | } |
82 | 82 | } else { |
@@ -134,31 +134,31 @@ discard block |
||
134 | 134 | } else { |
135 | 135 | $this->instance = $this->instance ?: new RedisClient(); |
136 | 136 | |
137 | - $host = isset($this->config[ 'host' ]) ? (string) $this->config[ 'host' ] : '127.0.0.1'; |
|
138 | - $path = isset($this->config[ 'path' ]) ? (string) $this->config[ 'path' ] : false; |
|
139 | - $port = isset($this->config[ 'port' ]) ? (int) $this->config[ 'port' ] : 6379; |
|
140 | - $password = isset($this->config[ 'password' ]) ? (string) $this->config[ 'password' ] : ''; |
|
141 | - $database = isset($this->config[ 'database' ]) ? $this->config[ 'database' ] : false; |
|
142 | - $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : ''; |
|
137 | + $host = isset($this->config['host']) ? (string) $this->config['host'] : '127.0.0.1'; |
|
138 | + $path = isset($this->config['path']) ? (string) $this->config['path'] : false; |
|
139 | + $port = isset($this->config['port']) ? (int) $this->config['port'] : 6379; |
|
140 | + $password = isset($this->config['password']) ? (string) $this->config['password'] : ''; |
|
141 | + $database = isset($this->config['database']) ? $this->config['database'] : false; |
|
142 | + $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : ''; |
|
143 | 143 | |
144 | 144 | /** |
145 | 145 | * If path is provided we consider it as an UNIX Socket |
146 | 146 | */ |
147 | - if($path){ |
|
147 | + if ($path) { |
|
148 | 148 | $isConnected = $this->instance->connect($path); |
149 | - }else{ |
|
150 | - $isConnected = $this->instance->connect($host, (int)$port, (int)$timeout); |
|
149 | + } else { |
|
150 | + $isConnected = $this->instance->connect($host, (int) $port, (int) $timeout); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | if (!$isConnected && $path) { |
154 | 154 | return false; |
155 | - } else if(!$path) { |
|
155 | + } else if (!$path) { |
|
156 | 156 | if ($password && !$this->instance->auth($password)) { |
157 | 157 | return false; |
158 | 158 | } |
159 | 159 | } |
160 | 160 | if ($database !== false) { |
161 | - $this->instance->select((int)$database); |
|
161 | + $this->instance->select((int) $database); |
|
162 | 162 | } |
163 | 163 | return true; |
164 | 164 | } |
@@ -177,13 +177,13 @@ discard block |
||
177 | 177 | { |
178 | 178 | // used_memory |
179 | 179 | $info = $this->instance->info(); |
180 | - $date = (new \DateTime())->setTimestamp(time() - $info[ 'uptime_in_seconds' ]); |
|
180 | + $date = (new \DateTime())->setTimestamp(time() - $info['uptime_in_seconds']); |
|
181 | 181 | |
182 | 182 | return (new DriverStatistic()) |
183 | 183 | ->setData(implode(', ', array_keys($this->itemInstances))) |
184 | 184 | ->setRawData($info) |
185 | - ->setSize($info[ 'used_memory' ]) |
|
185 | + ->setSize($info['used_memory']) |
|
186 | 186 | ->setInfo(sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", |
187 | - $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
|
187 | + $info['redis_version'], $date->format(DATE_RFC2822))); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | \ No newline at end of file |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | if($ttl <= 0){ |
78 | 78 | return $this->instance->expire($item->getKey(), 0); |
79 | - }else{ |
|
79 | + } else{ |
|
80 | 80 | return $this->instance->setex($item->getKey(), $ttl, $this->encode($this->driverPreWrap($item))); |
81 | 81 | } |
82 | 82 | } else { |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | if($path){ |
148 | 148 | $isConnected = $this->instance->connect($path); |
149 | - }else{ |
|
149 | + } else{ |
|
150 | 150 | $isConnected = $this->instance->connect($host, (int)$port, (int)$timeout); |
151 | 151 | } |
152 | 152 |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * due to performance issue on huge |
76 | 76 | * loop dispatching operations |
77 | 77 | */ |
78 | - if (isset($this->events[ $eventName ])) { |
|
79 | - foreach ($this->events[ $eventName ] as $event) { |
|
78 | + if (isset($this->events[$eventName])) { |
|
79 | + foreach ($this->events[$eventName] as $event) { |
|
80 | 80 | call_user_func_array($event, $args); |
81 | 81 | } |
82 | 82 | } |
@@ -92,14 +92,14 @@ discard block |
||
92 | 92 | { |
93 | 93 | if (strpos($name, 'on') === 0) { |
94 | 94 | $name = substr($name, 2); |
95 | - if (is_callable($arguments[ 0 ])) { |
|
96 | - if (isset($arguments[ 1 ]) && is_string($arguments[ 0 ])) { |
|
97 | - $this->events[ $name ][ $arguments[ 1 ] ] = $arguments[ 0 ]; |
|
95 | + if (is_callable($arguments[0])) { |
|
96 | + if (isset($arguments[1]) && is_string($arguments[0])) { |
|
97 | + $this->events[$name][$arguments[1]] = $arguments[0]; |
|
98 | 98 | } else { |
99 | - $this->events[ $name ][] = $arguments[ 0 ]; |
|
99 | + $this->events[$name][] = $arguments[0]; |
|
100 | 100 | } |
101 | 101 | } else { |
102 | - throw new phpFastCacheInvalidArgumentException(sprintf('Expected Callable, got "%s"', gettype($arguments[ 0 ]))); |
|
102 | + throw new phpFastCacheInvalidArgumentException(sprintf('Expected Callable, got "%s"', gettype($arguments[0]))); |
|
103 | 103 | } |
104 | 104 | } else { |
105 | 105 | throw new \BadMethodCallException('An event must start with "on" such as "onCacheGetItem"'); |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function unbindEventCallback($eventName, $callbackName) |
115 | 115 | { |
116 | - if (isset($this->events[ $eventName ][ $callbackName ])) { |
|
117 | - unset($this->events[ $eventName ][ $callbackName ]); |
|
116 | + if (isset($this->events[$eventName][$callbackName])) { |
|
117 | + unset($this->events[$eventName][$callbackName]); |
|
118 | 118 | return true; |
119 | 119 | } |
120 | 120 | return false; |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | protected static function cleanFileName($filename) |
192 | 192 | { |
193 | 193 | $regex = [ |
194 | - '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/', |
|
195 | - '/\.$/', |
|
196 | - '/^\./', |
|
194 | + '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/', |
|
195 | + '/\.$/', |
|
196 | + '/^\./', |
|
197 | 197 | ]; |
198 | 198 | $replace = ['-', '', '']; |
199 | 199 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | $tmpFilename = Directory::getAbsolutePath(dirname($file) . '/tmp_' . md5( |
290 | 290 | str_shuffle(uniqid($this->getDriverName(), false)) |
291 | 291 | . str_shuffle(uniqid($this->getDriverName(), false)) |
292 | - )); |
|
292 | + )); |
|
293 | 293 | |
294 | 294 | $f = fopen($tmpFilename, 'w+'); |
295 | 295 | flock($f, LOCK_EX); |
@@ -331,11 +331,11 @@ discard block |
||
331 | 331 | } |
332 | 332 | |
333 | 333 | $stat->setData(implode(', ', array_keys($this->itemInstances))) |
334 | - ->setRawData([ |
|
334 | + ->setRawData([ |
|
335 | 335 | 'tmp' => $this->tmp, |
336 | - ]) |
|
337 | - ->setSize(Directory::dirSize($path)) |
|
338 | - ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path)); |
|
336 | + ]) |
|
337 | + ->setSize(Directory::dirSize($path)) |
|
338 | + ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path)); |
|
339 | 339 | |
340 | 340 | return $stat; |
341 | 341 | } |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | * Calculate the security key |
52 | 52 | */ |
53 | 53 | { |
54 | - $securityKey = array_key_exists('securityKey', $this->config) ? $this->config[ 'securityKey' ] : ''; |
|
54 | + $securityKey = array_key_exists('securityKey', $this->config) ? $this->config['securityKey'] : ''; |
|
55 | 55 | if (!$securityKey || mb_strtolower($securityKey) === 'auto') { |
56 | - if (isset($_SERVER[ 'HTTP_HOST' ])) { |
|
57 | - $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER[ 'HTTP_HOST' ]))); |
|
56 | + if (isset($_SERVER['HTTP_HOST'])) { |
|
57 | + $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER['HTTP_HOST']))); |
|
58 | 58 | } else { |
59 | 59 | $securityKey = ($this->isPHPModule() ? 'web' : 'cli'); |
60 | 60 | } |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | */ |
74 | 74 | $tmp_dir = rtrim($tmp_dir, '/') . DIRECTORY_SEPARATOR; |
75 | 75 | |
76 | - if (empty($this->config[ 'path' ]) || !is_string($this->config[ 'path' ])) { |
|
76 | + if (empty($this->config['path']) || !is_string($this->config['path'])) { |
|
77 | 77 | $path = $tmp_dir; |
78 | 78 | } else { |
79 | - $path = rtrim($this->config[ 'path' ], '/') . DIRECTORY_SEPARATOR; |
|
79 | + $path = rtrim($this->config['path'], '/') . DIRECTORY_SEPARATOR; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | $path_suffix = $securityKey . DIRECTORY_SEPARATOR . $this->getDriverName(); |
@@ -91,16 +91,16 @@ discard block |
||
91 | 91 | * return the temp dir |
92 | 92 | */ |
93 | 93 | if ($readonly === true) { |
94 | - if ($this->config[ 'autoTmpFallback' ] && (!@file_exists($full_path) || !@is_writable($full_path))) { |
|
94 | + if ($this->config['autoTmpFallback'] && (!@file_exists($full_path) || !@is_writable($full_path))) { |
|
95 | 95 | return $full_path_tmp; |
96 | 96 | } |
97 | 97 | return $full_path; |
98 | 98 | } else { |
99 | - if (!isset($this->tmp[ $full_path_hash ]) || (!@file_exists($full_path) || !@is_writable($full_path))) { |
|
99 | + if (!isset($this->tmp[$full_path_hash]) || (!@file_exists($full_path) || !@is_writable($full_path))) { |
|
100 | 100 | if (!@file_exists($full_path)) { |
101 | 101 | @mkdir($full_path, $this->getDefaultChmod(), true); |
102 | 102 | } else if (!@is_writable($full_path)) { |
103 | - if (!@chmod($full_path, $this->getDefaultChmod()) && $this->config[ 'autoTmpFallback' ]) { |
|
103 | + if (!@chmod($full_path, $this->getDefaultChmod()) && $this->config['autoTmpFallback']) { |
|
104 | 104 | /** |
105 | 105 | * Switch back to tmp dir |
106 | 106 | * again if the path is not writable |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | throw new phpFastCacheIOException('Path "' . $full_path . '" is not writable, please set a chmod 0777 or any writable permission and make sure to make use of an absolute path !'); |
122 | 122 | } |
123 | 123 | |
124 | - $this->tmp[ $full_path_hash ] = $full_path; |
|
125 | - $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config[ 'htaccess' ] : false); |
|
124 | + $this->tmp[$full_path_hash] = $full_path; |
|
125 | + $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config['htaccess'] : false); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | - return $path . '/' . $filename . '.' . $this->config[ 'cacheFileExtension' ]; |
|
162 | + return $path . '/' . $filename . '.' . $this->config['cacheFileExtension']; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -177,10 +177,10 @@ discard block |
||
177 | 177 | */ |
178 | 178 | protected function getDefaultChmod() |
179 | 179 | { |
180 | - if (!isset($this->config[ 'default_chmod' ]) || $this->config[ 'default_chmod' ] == '' || is_null($this->config[ 'default_chmod' ])) { |
|
180 | + if (!isset($this->config['default_chmod']) || $this->config['default_chmod'] == '' || is_null($this->config['default_chmod'])) { |
|
181 | 181 | return 0777; |
182 | 182 | } else { |
183 | - return $this->config[ 'default_chmod' ]; |
|
183 | + return $this->config['default_chmod']; |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | if ($driverArray) { |
90 | 90 | if (!is_array($driverArray)) { |
91 | 91 | throw new phpFastCacheCoreException(sprintf('The driverRead method returned an unexpected variable type: %s', |
92 | - gettype($driverArray))); |
|
92 | + gettype($driverArray))); |
|
93 | 93 | } |
94 | 94 | $driverData = $this->driverUnwrapData($driverArray); |
95 | 95 | |
@@ -155,9 +155,9 @@ discard block |
||
155 | 155 | * Reset the Item |
156 | 156 | */ |
157 | 157 | $item->set(null) |
158 | - ->expiresAfter(abs((int)$this->getConfig()[ 'defaultTtl' ])) |
|
159 | - ->setHit(false) |
|
160 | - ->setTags([]); |
|
158 | + ->expiresAfter(abs((int)$this->getConfig()[ 'defaultTtl' ])) |
|
159 | + ->setHit(false) |
|
160 | + ->setTags([]); |
|
161 | 161 | if ($this->config[ 'itemDetailedDate' ]) { |
162 | 162 | |
163 | 163 | /** |
@@ -336,8 +336,8 @@ discard block |
||
336 | 336 | $class = new \ReflectionClass((new \ReflectionObject($this))->getNamespaceName() . '\Item'); |
337 | 337 | $itemBatch = $class->newInstanceArgs([$this, $item->getKey()]); |
338 | 338 | $itemBatch->setEventManager($this->eventManager) |
339 | - ->set(new ItemBatch($item->getKey(), new \DateTime())) |
|
340 | - ->expiresAfter($this->getConfig()[ 'cacheSlamsTimeout' ]); |
|
339 | + ->set(new ItemBatch($item->getKey(), new \DateTime())) |
|
340 | + ->expiresAfter($this->getConfig()[ 'cacheSlamsTimeout' ]); |
|
341 | 341 | |
342 | 342 | /** |
343 | 343 | * To avoid SPL mismatches |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | * due to performance issue on huge |
69 | 69 | * loop dispatching operations |
70 | 70 | */ |
71 | - if (!isset($this->itemInstances[ $key ])) { |
|
71 | + if (!isset($this->itemInstances[$key])) { |
|
72 | 72 | if (preg_match('~([' . preg_quote(self::$unsupportedKeyChars, '~') . ']+)~', $key, $matches)) { |
73 | - throw new phpFastCacheInvalidArgumentException('Unsupported key character detected: "' . $matches[ 1 ] . '". Please check: https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV6%CB%96%5D-Unsupported-characters-in-key-identifiers'); |
|
73 | + throw new phpFastCacheInvalidArgumentException('Unsupported key character detected: "' . $matches[1] . '". Please check: https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV6%CB%96%5D-Unsupported-characters-in-key-identifiers'); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | } |
94 | 94 | $driverData = $this->driverUnwrapData($driverArray); |
95 | 95 | |
96 | - if ($this->getConfig()[ 'preventCacheSlams' ]) { |
|
96 | + if ($this->getConfig()['preventCacheSlams']) { |
|
97 | 97 | while ($driverData instanceof ItemBatch) { |
98 | - if ($driverData->getItemDate()->getTimestamp() + $this->getConfig()[ 'cacheSlamsTimeout' ] < time()) { |
|
98 | + if ($driverData->getItemDate()->getTimestamp() + $this->getConfig()['cacheSlamsTimeout'] < time()) { |
|
99 | 99 | /** |
100 | 100 | * The timeout has been reached |
101 | 101 | * Consider that the batch has |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $item->set($driverData); |
128 | 128 | $item->expiresAt($this->driverUnwrapEdate($driverArray)); |
129 | 129 | |
130 | - if ($this->config[ 'itemDetailedDate' ]) { |
|
130 | + if ($this->config['itemDetailedDate']) { |
|
131 | 131 | |
132 | 132 | /** |
133 | 133 | * If the itemDetailedDate has been |
@@ -155,10 +155,10 @@ discard block |
||
155 | 155 | * Reset the Item |
156 | 156 | */ |
157 | 157 | $item->set(null) |
158 | - ->expiresAfter(abs((int)$this->getConfig()[ 'defaultTtl' ])) |
|
158 | + ->expiresAfter(abs((int) $this->getConfig()['defaultTtl'])) |
|
159 | 159 | ->setHit(false) |
160 | 160 | ->setTags([]); |
161 | - if ($this->config[ 'itemDetailedDate' ]) { |
|
161 | + if ($this->config['itemDetailedDate']) { |
|
162 | 162 | |
163 | 163 | /** |
164 | 164 | * If the itemDetailedDate has been |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $item->setHit(true); |
173 | 173 | } |
174 | 174 | } else { |
175 | - $item->expiresAfter(abs((int)$this->getConfig()[ 'defaultTtl' ])); |
|
175 | + $item->expiresAfter(abs((int) $this->getConfig()['defaultTtl'])); |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 | } |
@@ -185,9 +185,9 @@ discard block |
||
185 | 185 | * @param $this ExtendedCacheItemPoolInterface |
186 | 186 | * @param $this ExtendedCacheItemInterface |
187 | 187 | */ |
188 | - $this->eventManager->dispatch('CacheGetItem', $this, $this->itemInstances[ $key ]); |
|
188 | + $this->eventManager->dispatch('CacheGetItem', $this, $this->itemInstances[$key]); |
|
189 | 189 | |
190 | - return $this->itemInstances[ $key ]; |
|
190 | + return $this->itemInstances[$key]; |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | public function setItem(CacheItemInterface $item) |
199 | 199 | { |
200 | 200 | if ($this->getClassNamespace() . '\\Item' === get_class($item)) { |
201 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
201 | + $this->itemInstances[$item->getKey()] = $item; |
|
202 | 202 | |
203 | 203 | return $this; |
204 | 204 | } else { |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | { |
216 | 216 | $collection = []; |
217 | 217 | foreach ($keys as $key) { |
218 | - $collection[ $key ] = $this->getItem($key); |
|
218 | + $collection[$key] = $this->getItem($key); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | return $collection; |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | } |
303 | 303 | } |
304 | 304 | |
305 | - return (bool)$return; |
|
305 | + return (bool) $return; |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
@@ -320,9 +320,9 @@ discard block |
||
320 | 320 | * due to performance issue on huge |
321 | 321 | * loop dispatching operations |
322 | 322 | */ |
323 | - if (!isset($this->itemInstances[ $item->getKey() ])) { |
|
324 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
325 | - } else if (spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])) { |
|
323 | + if (!isset($this->itemInstances[$item->getKey()])) { |
|
324 | + $this->itemInstances[$item->getKey()] = $item; |
|
325 | + } else if (spl_object_hash($item) !== spl_object_hash($this->itemInstances[$item->getKey()])) { |
|
326 | 326 | throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.'); |
327 | 327 | } |
328 | 328 | |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | $this->eventManager->dispatch('CacheSaveItem', $this, $item); |
335 | 335 | |
336 | 336 | |
337 | - if ($this->getConfig()[ 'preventCacheSlams' ]) { |
|
337 | + if ($this->getConfig()['preventCacheSlams']) { |
|
338 | 338 | /** |
339 | 339 | * @var $itemBatch ExtendedCacheItemInterface |
340 | 340 | */ |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | $itemBatch = $class->newInstanceArgs([$this, $item->getKey()]); |
343 | 343 | $itemBatch->setEventManager($this->eventManager) |
344 | 344 | ->set(new ItemBatch($item->getKey(), new \DateTime())) |
345 | - ->expiresAfter($this->getConfig()[ 'cacheSlamsTimeout' ]); |
|
345 | + ->expiresAfter($this->getConfig()['cacheSlamsTimeout']); |
|
346 | 346 | |
347 | 347 | /** |
348 | 348 | * To avoid SPL mismatches |
@@ -374,8 +374,8 @@ discard block |
||
374 | 374 | public function saveDeferred(CacheItemInterface $item) |
375 | 375 | { |
376 | 376 | if (!array_key_exists($item->getKey(), $this->itemInstances)) { |
377 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
378 | - } else if (spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])) { |
|
377 | + $this->itemInstances[$item->getKey()] = $item; |
|
378 | + } else if (spl_object_hash($item) !== spl_object_hash($this->itemInstances[$item->getKey()])) { |
|
379 | 379 | throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.'); |
380 | 380 | } |
381 | 381 | |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | */ |
387 | 387 | $this->eventManager->dispatch('CacheSaveDeferredItem', $this, $item); |
388 | 388 | |
389 | - return $this->deferredList[ $item->getKey() ] = $item; |
|
389 | + return $this->deferredList[$item->getKey()] = $item; |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | /** |
@@ -406,11 +406,11 @@ discard block |
||
406 | 406 | foreach ($this->deferredList as $key => $item) { |
407 | 407 | $result = $this->save($item); |
408 | 408 | if ($return !== false) { |
409 | - unset($this->deferredList[ $key ]); |
|
409 | + unset($this->deferredList[$key]); |
|
410 | 410 | $return = $result; |
411 | 411 | } |
412 | 412 | } |
413 | 413 | |
414 | - return (bool)$return; |
|
414 | + return (bool) $return; |
|
415 | 415 | } |
416 | 416 | } |
@@ -139,9 +139,9 @@ |
||
139 | 139 | public function driverPreWrap(ExtendedCacheItemInterface $item) |
140 | 140 | { |
141 | 141 | $wrap = [ |
142 | - self::DRIVER_DATA_WRAPPER_INDEX => $item->get(), |
|
143 | - self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(), |
|
144 | - self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(), |
|
142 | + self::DRIVER_DATA_WRAPPER_INDEX => $item->get(), |
|
143 | + self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(), |
|
144 | + self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(), |
|
145 | 145 | ]; |
146 | 146 | |
147 | 147 | if ($this->config[ 'itemDetailedDate' ]) { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | if (is_array($config_name)) { |
60 | 60 | $this->config = array_merge($this->config, $config_name); |
61 | 61 | } else { |
62 | - $this->config[ $config_name ] = $value; |
|
62 | + $this->config[$config_name] = $value; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function getConfigOption($optionName) |
79 | 79 | { |
80 | - if (isset($this->config[ $optionName ])) { |
|
81 | - return $this->config[ $optionName ]; |
|
80 | + if (isset($this->config[$optionName])) { |
|
81 | + return $this->config[$optionName]; |
|
82 | 82 | } else { |
83 | 83 | return null; |
84 | 84 | } |
@@ -149,16 +149,16 @@ discard block |
||
149 | 149 | self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(), |
150 | 150 | ]; |
151 | 151 | |
152 | - if ($this->config[ 'itemDetailedDate' ]) { |
|
153 | - $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = new \DateTime(); |
|
152 | + if ($this->config['itemDetailedDate']) { |
|
153 | + $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = new \DateTime(); |
|
154 | 154 | /** |
155 | 155 | * If the creation date exists |
156 | 156 | * reuse it else set a new Date |
157 | 157 | */ |
158 | - $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = $item->getCreationDate() ?: new \DateTime(); |
|
158 | + $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = $item->getCreationDate() ?: new \DateTime(); |
|
159 | 159 | } else { |
160 | - $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = null; |
|
161 | - $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = null; |
|
160 | + $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = null; |
|
161 | + $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = null; |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | return $wrap; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function driverUnwrapData(array $wrapper) |
172 | 172 | { |
173 | - return $wrapper[ self::DRIVER_DATA_WRAPPER_INDEX ]; |
|
173 | + return $wrapper[self::DRIVER_DATA_WRAPPER_INDEX]; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function driverUnwrapTags(array $wrapper) |
181 | 181 | { |
182 | - return $wrapper[ self::DRIVER_TAGS_WRAPPER_INDEX ]; |
|
182 | + return $wrapper[self::DRIVER_TAGS_WRAPPER_INDEX]; |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function driverUnwrapEdate(array $wrapper) |
191 | 191 | { |
192 | - return $wrapper[ self::DRIVER_EDATE_WRAPPER_INDEX ]; |
|
192 | + return $wrapper[self::DRIVER_EDATE_WRAPPER_INDEX]; |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function driverUnwrapCdate(array $wrapper) |
200 | 200 | { |
201 | - return $wrapper[ self::DRIVER_CDATE_WRAPPER_INDEX ]; |
|
201 | + return $wrapper[self::DRIVER_CDATE_WRAPPER_INDEX]; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function driverUnwrapMdate(array $wrapper) |
210 | 210 | { |
211 | - return $wrapper[ self::DRIVER_MDATE_WRAPPER_INDEX ]; |
|
211 | + return $wrapper[self::DRIVER_MDATE_WRAPPER_INDEX]; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function getDriverName() |
218 | 218 | { |
219 | - if(!$this->driverName){ |
|
219 | + if (!$this->driverName) { |
|
220 | 220 | $this->driverName = ucfirst(substr(strrchr((new \ReflectionObject($this))->getNamespaceName(), '\\'), 1)); |
221 | 221 | } |
222 | 222 | return $this->driverName; |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | throw new phpFastCacheLogicException('Trying to set tag(s) to an Tag item index: ' . $item->getKey()); |
239 | 239 | } |
240 | 240 | |
241 | - if(!$item->getTags() && !$item->getRemovedTags()) |
|
241 | + if (!$item->getTags() && !$item->getRemovedTags()) |
|
242 | 242 | { |
243 | 243 | return true; |
244 | 244 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * that has slow performances |
259 | 259 | */ |
260 | 260 | |
261 | - $tagsItem->set(array_merge((array)$data, [$item->getKey() => $expTimestamp])); |
|
261 | + $tagsItem->set(array_merge((array) $data, [$item->getKey() => $expTimestamp])); |
|
262 | 262 | |
263 | 263 | /** |
264 | 264 | * Set the expiration date |
@@ -280,9 +280,9 @@ discard block |
||
280 | 280 | $tagsItems = $this->getItems($this->getTagKeys($item->getRemovedTags())); |
281 | 281 | |
282 | 282 | foreach ($tagsItems as $tagsItem) { |
283 | - $data = (array)$tagsItem->get(); |
|
283 | + $data = (array) $tagsItem->get(); |
|
284 | 284 | |
285 | - unset($data[ $item->getKey() ]); |
|
285 | + unset($data[$item->getKey()]); |
|
286 | 286 | $tagsItem->set($data); |
287 | 287 | |
288 | 288 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function getCreationDate() |
113 | 113 | { |
114 | - if ($this->driver->getConfig()[ 'itemDetailedDate' ]) { |
|
114 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
115 | 115 | return $this->creationDate; |
116 | 116 | } else { |
117 | 117 | throw new phpFastCacheLogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function setCreationDate(\DateTimeInterface $date) |
127 | 127 | { |
128 | - if ($this->driver->getConfig()[ 'itemDetailedDate' ]) { |
|
128 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
129 | 129 | $this->creationDate = $date; |
130 | 130 | return $this; |
131 | 131 | } else { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function getModificationDate() |
141 | 141 | { |
142 | - if ($this->driver->getConfig()[ 'itemDetailedDate' ]) { |
|
142 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
143 | 143 | return $this->modificationDate; |
144 | 144 | } else { |
145 | 145 | throw new phpFastCacheLogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.'); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function setModificationDate(\DateTimeInterface $date) |
155 | 155 | { |
156 | - if ($this->driver->getConfig()[ 'itemDetailedDate' ]) { |
|
156 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
157 | 157 | $this->modificationDate = $date; |
158 | 158 | return $this; |
159 | 159 | } else { |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | if (is_array($this->data)) { |
227 | 227 | $this->data[] = $data; |
228 | 228 | } else if (is_string($data)) { |
229 | - $this->data .= (string)$data; |
|
229 | + $this->data .= (string) $data; |
|
230 | 230 | } else { |
231 | 231 | throw new phpFastCacheInvalidArgumentException('$data must be either array nor string.'); |
232 | 232 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | if (is_array($this->data)) { |
246 | 246 | array_unshift($this->data, $data); |
247 | 247 | } else if (is_string($data)) { |
248 | - $this->data = (string)$data . $this->data; |
|
248 | + $this->data = (string) $data . $this->data; |
|
249 | 249 | } else { |
250 | 250 | throw new phpFastCacheInvalidArgumentException('$data must be either array nor string.'); |
251 | 251 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | public function removeTag($tagName) |
325 | 325 | { |
326 | 326 | if (($key = array_search($tagName, $this->tags)) !== false) { |
327 | - unset($this->tags[ $key ]); |
|
327 | + unset($this->tags[$key]); |
|
328 | 328 | $this->removedTags[] = $tagName; |
329 | 329 | } |
330 | 330 | |
@@ -403,8 +403,8 @@ discard block |
||
403 | 403 | final public function __debugInfo() |
404 | 404 | { |
405 | 405 | $info = get_object_vars($this); |
406 | - $info[ 'driver' ] = 'object(' . get_class($info[ 'driver' ]) . ')'; |
|
406 | + $info['driver'] = 'object(' . get_class($info['driver']) . ')'; |
|
407 | 407 | |
408 | - return (array)$info; |
|
408 | + return (array) $info; |
|
409 | 409 | } |
410 | 410 | } |
411 | 411 | \ No newline at end of file |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function __construct() |
38 | 38 | { |
39 | - $this->instances =& CacheManager::getInternalInstances(); |
|
39 | + $this->instances = & CacheManager::getInternalInstances(); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | protected function getGenericCallback() |
46 | 46 | { |
47 | - return function ($method, $args) { |
|
47 | + return function($method, $args) { |
|
48 | 48 | $getterMethod = (strpos($method, 'get') === 0); |
49 | 49 | $return = false; |
50 | 50 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | foreach ($this->instances as $instance) { |
56 | 56 | $reflectionMethod = new \ReflectionMethod(get_class($instance), $method); |
57 | 57 | if ($getterMethod) { |
58 | - $return[ $instance->getDriverName() ] = $reflectionMethod->invokeArgs($instance, $args); |
|
58 | + $return[$instance->getDriverName()] = $reflectionMethod->invokeArgs($instance, $args); |
|
59 | 59 | } else { |
60 | 60 | $result = $reflectionMethod->invokeArgs($instance, $args); |
61 | 61 | if ($result !== false) { |
@@ -207,24 +207,24 @@ discard block |
||
207 | 207 | } |
208 | 208 | |
209 | 209 | $instance = crc32($driver . serialize($config)); |
210 | - if (!isset(self::$instances[ $instance ])) { |
|
211 | - $badPracticeOmeter[ $driver ] = 1; |
|
212 | - if (!$config[ 'ignoreSymfonyNotice' ] && interface_exists('Symfony\Component\HttpKernel\KernelInterface') && !class_exists('phpFastCache\Bundle\phpFastCacheBundle')) { |
|
210 | + if (!isset(self::$instances[$instance])) { |
|
211 | + $badPracticeOmeter[$driver] = 1; |
|
212 | + if (!$config['ignoreSymfonyNotice'] && interface_exists('Symfony\Component\HttpKernel\KernelInterface') && !class_exists('phpFastCache\Bundle\phpFastCacheBundle')) { |
|
213 | 213 | trigger_error('A Symfony Bundle to make the PhpFastCache integration more easier is now available here: https://github.com/PHPSocialNetwork/phpfastcache-bundle', |
214 | 214 | E_USER_NOTICE); |
215 | 215 | } |
216 | 216 | $class = self::getNamespacePath() . $driver . '\Driver'; |
217 | 217 | try { |
218 | - self::$instances[ $instance ] = new $class($config); |
|
219 | - self::$instances[ $instance ]->setEventManager(EventManager::getInstance()); |
|
218 | + self::$instances[$instance] = new $class($config); |
|
219 | + self::$instances[$instance]->setEventManager(EventManager::getInstance()); |
|
220 | 220 | } catch (phpFastCacheDriverCheckException $e) { |
221 | - if ($config[ 'fallback' ]) { |
|
221 | + if ($config['fallback']) { |
|
222 | 222 | try { |
223 | - $fallback = self::standardizeDriverName($config[ 'fallback' ]); |
|
223 | + $fallback = self::standardizeDriverName($config['fallback']); |
|
224 | 224 | if ($fallback !== $driver) { |
225 | 225 | $class = self::getNamespacePath() . $fallback . '\Driver'; |
226 | - self::$instances[ $instance ] = new $class($config); |
|
227 | - self::$instances[ $instance ]->setEventManager(EventManager::getInstance()); |
|
226 | + self::$instances[$instance] = new $class($config); |
|
227 | + self::$instances[$instance]->setEventManager(EventManager::getInstance()); |
|
228 | 228 | trigger_error(sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver, |
229 | 229 | $fallback), E_USER_WARNING); |
230 | 230 | } else { |
@@ -237,14 +237,14 @@ discard block |
||
237 | 237 | throw new phpFastCacheDriverCheckException($e->getMessage(), $e->getCode(), $e); |
238 | 238 | } |
239 | 239 | } |
240 | - } else if ($badPracticeOmeter[ $driver ] >= 5) { |
|
240 | + } else if ($badPracticeOmeter[$driver] >= 5) { |
|
241 | 241 | trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances. |
242 | 242 | See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F'); |
243 | 243 | } |
244 | 244 | |
245 | - $badPracticeOmeter[ $driver ]++; |
|
245 | + $badPracticeOmeter[$driver]++; |
|
246 | 246 | |
247 | - return self::$instances[ $instance ]; |
|
247 | + return self::$instances[$instance]; |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | /** |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | */ |
306 | 306 | public static function __callStatic($name, $arguments) |
307 | 307 | { |
308 | - $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[ 0 ] : []); |
|
308 | + $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[0] : []); |
|
309 | 309 | |
310 | 310 | return self::getInstance($name, $options); |
311 | 311 | } |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | if (is_array($name)) { |
348 | 348 | self::$config = array_merge(self::$config, $name); |
349 | 349 | } else if (is_string($name)) { |
350 | - self::$config[ $name ] = $value; |
|
350 | + self::$config[$name] = $value; |
|
351 | 351 | } else { |
352 | 352 | throw new phpFastCacheInvalidArgumentException('Invalid variable type: $name'); |
353 | 353 | } |
@@ -65,101 +65,101 @@ discard block |
||
65 | 65 | /** |
66 | 66 | * Specify if the item must provide detailed creation/modification dates |
67 | 67 | */ |
68 | - 'itemDetailedDate' => false, |
|
68 | + 'itemDetailedDate' => false, |
|
69 | 69 | |
70 | 70 | /** |
71 | 71 | * Automatically attempt to fallback to temporary directory |
72 | 72 | * if the cache fails to write on the specified directory |
73 | 73 | */ |
74 | - 'autoTmpFallback' => false, |
|
74 | + 'autoTmpFallback' => false, |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Provide a secure file manipulation mechanism, |
78 | 78 | * on intensive usage the performance can be affected. |
79 | 79 | */ |
80 | - 'secureFileManipulation' => false, |
|
80 | + 'secureFileManipulation' => false, |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Ignore Symfony notice for Symfony project which |
84 | 84 | * do not makes use of PhpFastCache's Symfony Bundle |
85 | 85 | */ |
86 | - 'ignoreSymfonyNotice' => false, |
|
86 | + 'ignoreSymfonyNotice' => false, |
|
87 | 87 | |
88 | 88 | /** |
89 | 89 | * Default time-to-live in second |
90 | 90 | */ |
91 | - 'defaultTtl' => 900, |
|
91 | + 'defaultTtl' => 900, |
|
92 | 92 | |
93 | 93 | /** |
94 | 94 | * Default key hash function |
95 | 95 | * (md5 by default) |
96 | 96 | */ |
97 | - 'defaultKeyHashFunction' => '', |
|
97 | + 'defaultKeyHashFunction' => '', |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * The securityKey that will be used |
101 | 101 | * to create sub-directory |
102 | 102 | * (Files-based drivers only) |
103 | 103 | */ |
104 | - 'securityKey' => 'Auto', |
|
104 | + 'securityKey' => 'Auto', |
|
105 | 105 | |
106 | 106 | /** |
107 | 107 | * Auto-generate .htaccess if it's missing |
108 | 108 | * (Files-based drivers only) |
109 | 109 | */ |
110 | - 'htaccess' => true, |
|
110 | + 'htaccess' => true, |
|
111 | 111 | |
112 | 112 | /** |
113 | 113 | * Default files chmod |
114 | 114 | * 0777 recommended |
115 | 115 | * (Files-based drivers only) |
116 | 116 | */ |
117 | - 'default_chmod' => 0777, |
|
117 | + 'default_chmod' => 0777, |
|
118 | 118 | |
119 | 119 | /** |
120 | 120 | * The path where we will writecache files |
121 | 121 | * default value if empty: sys_get_temp_dir() |
122 | 122 | * (Files-based drivers only) |
123 | 123 | */ |
124 | - 'path' => '', |
|
124 | + 'path' => '', |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * Driver fallback in case of failure. |
128 | 128 | * Caution, in case of failure an E_WARNING |
129 | 129 | * error will always be raised |
130 | 130 | */ |
131 | - 'fallback' => false, |
|
131 | + 'fallback' => false, |
|
132 | 132 | |
133 | 133 | /** |
134 | 134 | * Maximum size (bytes) of object store in memory |
135 | 135 | * (Memcache(d) drivers only) |
136 | 136 | */ |
137 | - 'limited_memory_each_object' => 4096, |
|
137 | + 'limited_memory_each_object' => 4096, |
|
138 | 138 | |
139 | 139 | /** |
140 | 140 | * Compress stored data, if the backend supports it |
141 | 141 | * (Memcache(d) drivers only) |
142 | 142 | */ |
143 | - 'compress_data' => false, |
|
143 | + 'compress_data' => false, |
|
144 | 144 | |
145 | 145 | /** |
146 | 146 | * Prevent cache slams when |
147 | 147 | * making use of heavy cache |
148 | 148 | * items |
149 | 149 | */ |
150 | - 'preventCacheSlams' => false, |
|
150 | + 'preventCacheSlams' => false, |
|
151 | 151 | |
152 | 152 | /** |
153 | 153 | * Cache slams timeout |
154 | 154 | * in seconds |
155 | 155 | */ |
156 | - 'cacheSlamsTimeout' => 15, |
|
156 | + 'cacheSlamsTimeout' => 15, |
|
157 | 157 | |
158 | 158 | /** |
159 | 159 | * Cache slams timeout |
160 | 160 | * in seconds |
161 | 161 | */ |
162 | - 'cacheFileExtension' => 'txt', |
|
162 | + 'cacheFileExtension' => 'txt', |
|
163 | 163 | |
164 | 164 | ]; |
165 | 165 | |
@@ -169,10 +169,10 @@ discard block |
||
169 | 169 | * @var array |
170 | 170 | */ |
171 | 171 | protected static $safeFileExtensions = [ |
172 | - 'txt', |
|
173 | - 'cache', |
|
174 | - 'db', |
|
175 | - 'pfc', |
|
172 | + 'txt', |
|
173 | + 'cache', |
|
174 | + 'db', |
|
175 | + 'pfc', |
|
176 | 176 | ]; |
177 | 177 | |
178 | 178 | /** |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $badPracticeOmeter[ $driver ] = 1; |
212 | 212 | if (!$config[ 'ignoreSymfonyNotice' ] && interface_exists('Symfony\Component\HttpKernel\KernelInterface') && !class_exists('phpFastCache\Bundle\phpFastCacheBundle')) { |
213 | 213 | trigger_error('A Symfony Bundle to make the PhpFastCache integration more easier is now available here: https://github.com/PHPSocialNetwork/phpfastcache-bundle', |
214 | - E_USER_NOTICE); |
|
214 | + E_USER_NOTICE); |
|
215 | 215 | } |
216 | 216 | $class = self::getNamespacePath() . $driver . '\Driver'; |
217 | 217 | try { |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | self::$instances[ $instance ] = new $class($config); |
227 | 227 | self::$instances[ $instance ]->setEventManager(EventManager::getInstance()); |
228 | 228 | trigger_error(sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver, |
229 | - $fallback), E_USER_WARNING); |
|
229 | + $fallback), E_USER_WARNING); |
|
230 | 230 | } else { |
231 | 231 | throw new phpFastCacheInvalidConfigurationException('The fallback driver cannot be the same than the default driver', 0, $e); |
232 | 232 | } |
@@ -379,26 +379,26 @@ discard block |
||
379 | 379 | public static function getStaticSystemDrivers() |
380 | 380 | { |
381 | 381 | return [ |
382 | - 'Apc', |
|
383 | - 'Apcu', |
|
384 | - 'Cassandra', |
|
385 | - 'Couchbase', |
|
386 | - 'Couchdb', |
|
387 | - 'Devnull', |
|
388 | - 'Files', |
|
389 | - 'Leveldb', |
|
390 | - 'Memcache', |
|
391 | - 'Memcached', |
|
392 | - 'Memstatic', |
|
393 | - 'Mongodb', |
|
394 | - 'Predis', |
|
395 | - 'Redis', |
|
396 | - 'Ssdb', |
|
397 | - 'Sqlite', |
|
398 | - 'Wincache', |
|
399 | - 'Xcache', |
|
400 | - 'Zenddisk', |
|
401 | - 'Zendshm', |
|
382 | + 'Apc', |
|
383 | + 'Apcu', |
|
384 | + 'Cassandra', |
|
385 | + 'Couchbase', |
|
386 | + 'Couchdb', |
|
387 | + 'Devnull', |
|
388 | + 'Files', |
|
389 | + 'Leveldb', |
|
390 | + 'Memcache', |
|
391 | + 'Memcached', |
|
392 | + 'Memstatic', |
|
393 | + 'Mongodb', |
|
394 | + 'Predis', |
|
395 | + 'Redis', |
|
396 | + 'Ssdb', |
|
397 | + 'Sqlite', |
|
398 | + 'Wincache', |
|
399 | + 'Xcache', |
|
400 | + 'Zenddisk', |
|
401 | + 'Zendshm', |
|
402 | 402 | ]; |
403 | 403 | } |
404 | 404 | |
@@ -408,9 +408,9 @@ discard block |
||
408 | 408 | public static function getStaticAllDrivers() |
409 | 409 | { |
410 | 410 | return array_merge(self::getStaticSystemDrivers(), [ |
411 | - 'Devtrue', |
|
412 | - 'Devfalse', |
|
413 | - 'Cookie', |
|
411 | + 'Devtrue', |
|
412 | + 'Devfalse', |
|
413 | + 'Cookie', |
|
414 | 414 | ]); |
415 | 415 | } |
416 | 416 |