@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | namespace Phpfastcache\Drivers\Couchdb; |
17 | 17 | |
18 | 18 | use Doctrine\CouchDB\{ |
19 | - CouchDBClient as CouchdbClient, CouchDBException |
|
19 | + CouchDBClient as CouchdbClient, CouchDBException |
|
20 | 20 | }; |
21 | 21 | use Phpfastcache\Config\ConfigurationOption; |
22 | 22 | use Phpfastcache\Core\Pool\{ |
23 | - DriverBaseTrait, ExtendedCacheItemPoolInterface |
|
23 | + DriverBaseTrait, ExtendedCacheItemPoolInterface |
|
24 | 24 | }; |
25 | 25 | use Phpfastcache\Exceptions\{ |
26 | - PhpfastcacheDriverException, PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
26 | + PhpfastcacheDriverException, PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
27 | 27 | }; |
28 | 28 | use Phpfastcache\Entities\DriverStatistic; |
29 | 29 | use Phpfastcache\Util\ArrayObject; |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | $url .= $clientConfig->getPath(); |
76 | 76 | |
77 | 77 | $this->instance = CouchDBClient::create([ |
78 | - 'dbname' => $this->getDatabaseName(), |
|
79 | - 'url' => $url, |
|
80 | - 'timeout' => $clientConfig->getTimeout(), |
|
78 | + 'dbname' => $this->getDatabaseName(), |
|
79 | + 'url' => $url, |
|
80 | + 'timeout' => $clientConfig->getTimeout(), |
|
81 | 81 | ]); |
82 | 82 | |
83 | 83 | $this->createDatabase(); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | if ($item instanceof Item) { |
125 | 125 | try { |
126 | 126 | $this->instance->putDocument(['data' => $this->encode($this->driverPreWrap($item))], $item->getEncodedKey(), |
127 | - $this->getLatestDocumentRevision($item->getEncodedKey())); |
|
127 | + $this->getLatestDocumentRevision($item->getEncodedKey())); |
|
128 | 128 | } catch (CouchDBException $e) { |
129 | 129 | throw new PhpfastcacheDriverException('Got error while trying to upsert a document: ' . $e->getMessage(), null, $e); |
130 | 130 | } |
@@ -181,10 +181,10 @@ discard block |
||
181 | 181 | $path = '/' . $this->getDatabaseName() . '/' . urlencode($docId); |
182 | 182 | |
183 | 183 | $response = $this->instance->getHttpClient()->request( |
184 | - 'HEAD', |
|
185 | - $path, |
|
186 | - null, |
|
187 | - false |
|
184 | + 'HEAD', |
|
185 | + $path, |
|
186 | + null, |
|
187 | + false |
|
188 | 188 | ); |
189 | 189 | if (!empty($response->headers[ 'etag' ])) { |
190 | 190 | return \trim($response->headers[ 'etag' ], " '\"\t\n\r\0\x0B"); |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | $info = $this->instance->getDatabaseInfo(); |
239 | 239 | |
240 | 240 | return (new DriverStatistic()) |
241 | - ->setSize($info[ 'sizes' ][ 'active' ]) |
|
242 | - ->setRawData($info) |
|
243 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
244 | - ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData."); |
|
241 | + ->setSize($info[ 'sizes' ][ 'active' ]) |
|
242 | + ->setRawData($info) |
|
243 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
244 | + ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData."); |
|
245 | 245 | } |
246 | 246 | } |
247 | 247 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Drivers\Couchdb; |
17 | 17 | |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | throw new PhpfastcacheDriverException('Got error while trying to get a document: ' . $e->getMessage(), null, $e); |
99 | 99 | } |
100 | 100 | |
101 | - if ($response->status === 404 || empty($response->body[ 'data' ])) { |
|
101 | + if ($response->status === 404 || empty($response->body['data'])) { |
|
102 | 102 | return null; |
103 | 103 | } |
104 | 104 | |
105 | 105 | if ($response->status === 200) { |
106 | - return $this->decode($response->body[ 'data' ]); |
|
106 | + return $this->decode($response->body['data']); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | throw new PhpfastcacheDriverException('Got unexpected HTTP status: ' . $response->status); |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | null, |
187 | 187 | false |
188 | 188 | ); |
189 | - if (!empty($response->headers[ 'etag' ])) { |
|
190 | - return \trim($response->headers[ 'etag' ], " '\"\t\n\r\0\x0B"); |
|
189 | + if (!empty($response->headers['etag'])) { |
|
190 | + return \trim($response->headers['etag'], " '\"\t\n\r\0\x0B"); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | return null; |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $info = $this->instance->getDatabaseInfo(); |
239 | 239 | |
240 | 240 | return (new DriverStatistic()) |
241 | - ->setSize($info[ 'sizes' ][ 'active' ]) |
|
241 | + ->setSize($info['sizes']['active']) |
|
242 | 242 | ->setRawData($info) |
243 | 243 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
244 | 244 | ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData."); |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | 'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead', |
118 | 118 | E_USER_DEPRECATED |
119 | 119 | ); |
120 | - }elseif ($config === null){ |
|
120 | + } elseif ($config === null){ |
|
121 | 121 | $config = self::getDefaultConfig(); |
122 | - }else if(!($config instanceof ConfigurationOption)){ |
|
122 | + } else if(!($config instanceof ConfigurationOption)){ |
|
123 | 123 | throw new PhpfastcacheInvalidArgumentException(\sprintf('Unsupported config type: %s', gettype($config))); |
124 | 124 | } |
125 | 125 | |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | { |
405 | 405 | if(!empty(self::$driverCustoms[$driverName])){ |
406 | 406 | $driverClass = self::$driverCustoms[$driverName]; |
407 | - }else if(!empty(self::$driverOverrides[$driverName])){ |
|
407 | + } else if(!empty(self::$driverOverrides[$driverName])){ |
|
408 | 408 | $driverClass = self::$driverOverrides[$driverName]; |
409 | 409 | } else{ |
410 | 410 | $driverClass = self::getNamespacePath() . $driverName . '\Driver'; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | use Phpfastcache\Config\ConfigurationOption; |
19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | - PhpfastcacheDeprecatedException, PhpfastcacheDriverCheckException, PhpfastcacheDriverException, PhpfastcacheDriverNotFoundException, PhpfastcacheInstanceNotFoundException, PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidConfigurationException, PhpfastcacheLogicException, PhpfastcacheUnsupportedOperationException |
|
21 | + PhpfastcacheDeprecatedException, PhpfastcacheDriverCheckException, PhpfastcacheDriverException, PhpfastcacheDriverNotFoundException, PhpfastcacheInstanceNotFoundException, PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidConfigurationException, PhpfastcacheLogicException, PhpfastcacheUnsupportedOperationException |
|
22 | 22 | }; |
23 | 23 | use Phpfastcache\Util\ClassNamespaceResolverTrait; |
24 | 24 | |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | if (\is_array($config)) { |
117 | 117 | $config = new ConfigurationOption($config); |
118 | 118 | trigger_error( |
119 | - 'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead', |
|
120 | - E_USER_DEPRECATED |
|
119 | + 'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead', |
|
120 | + E_USER_DEPRECATED |
|
121 | 121 | ); |
122 | 122 | }elseif ($config === null){ |
123 | 123 | $config = self::getDefaultConfig(); |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | |
140 | 140 | if(!is_a($driverClass, ExtendedCacheItemPoolInterface::class, true)){ |
141 | 141 | throw new PhpfastcacheDriverException(sprintf( |
142 | - 'Class "%s" does not implement "%s"', |
|
143 | - $driverClass, |
|
144 | - ExtendedCacheItemPoolInterface::class |
|
142 | + 'Class "%s" does not implement "%s"', |
|
143 | + $driverClass, |
|
144 | + ExtendedCacheItemPoolInterface::class |
|
145 | 145 | )); |
146 | 146 | } |
147 | 147 | try { |
@@ -328,27 +328,27 @@ discard block |
||
328 | 328 | { |
329 | 329 | trigger_error(\sprintf('Method "%s" is deprecated as of the V7 and will be removed soon or later, use CacheManager::getDriverList() instead.', __METHOD__), E_USER_DEPRECATED); |
330 | 330 | return [ |
331 | - 'Apc', |
|
332 | - 'Apcu', |
|
333 | - 'Cassandra', |
|
334 | - 'Couchbase', |
|
335 | - 'Couchdb', |
|
336 | - 'Devnull', |
|
337 | - 'Files', |
|
338 | - 'Leveldb', |
|
339 | - 'Memcache', |
|
340 | - 'Memcached', |
|
341 | - 'Memstatic', |
|
342 | - 'Mongodb', |
|
343 | - 'Predis', |
|
344 | - 'Redis', |
|
345 | - 'Riak', |
|
346 | - 'Ssdb', |
|
347 | - 'Sqlite', |
|
348 | - 'Wincache', |
|
349 | - 'Xcache', |
|
350 | - 'Zenddisk', |
|
351 | - 'Zendshm', |
|
331 | + 'Apc', |
|
332 | + 'Apcu', |
|
333 | + 'Cassandra', |
|
334 | + 'Couchbase', |
|
335 | + 'Couchdb', |
|
336 | + 'Devnull', |
|
337 | + 'Files', |
|
338 | + 'Leveldb', |
|
339 | + 'Memcache', |
|
340 | + 'Memcached', |
|
341 | + 'Memstatic', |
|
342 | + 'Mongodb', |
|
343 | + 'Predis', |
|
344 | + 'Redis', |
|
345 | + 'Riak', |
|
346 | + 'Ssdb', |
|
347 | + 'Sqlite', |
|
348 | + 'Wincache', |
|
349 | + 'Xcache', |
|
350 | + 'Zenddisk', |
|
351 | + 'Zendshm', |
|
352 | 352 | ]; |
353 | 353 | } |
354 | 354 | |
@@ -360,9 +360,9 @@ discard block |
||
360 | 360 | { |
361 | 361 | trigger_error(\sprintf('Method "%s" is deprecated as of the V7 and will be removed soon or later, use CacheManager::getDriverList() instead.', __METHOD__), E_USER_DEPRECATED); |
362 | 362 | return \array_merge(self::getStaticSystemDrivers(), [ |
363 | - 'Devtrue', |
|
364 | - 'Devfalse', |
|
365 | - 'Cookie', |
|
363 | + 'Devtrue', |
|
364 | + 'Devfalse', |
|
365 | + 'Cookie', |
|
366 | 366 | ]); |
367 | 367 | } |
368 | 368 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | |
441 | 441 | if(!\class_exists($className)){ |
442 | 442 | throw new PhpfastcacheInvalidArgumentException( |
443 | - sprintf("Can't add '%s' because the class '%s' does not exists", $driverName, $className) |
|
443 | + sprintf("Can't add '%s' because the class '%s' does not exists", $driverName, $className) |
|
444 | 444 | ); |
445 | 445 | } |
446 | 446 | |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | |
494 | 494 | if(!\class_exists($className)){ |
495 | 495 | throw new PhpfastcacheInvalidArgumentException( |
496 | - sprintf("Can't override '%s' because the class '%s' does not exists", $driverName, $className) |
|
496 | + sprintf("Can't override '%s' because the class '%s' does not exists", $driverName, $className) |
|
497 | 497 | ); |
498 | 498 | } |
499 | 499 | |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | |
508 | 508 | if(!\is_subclass_of($className, self::CORE_DRIVER_NAMESPACE . $driverName . '\\Driver', true)){ |
509 | 509 | throw new PhpfastcacheLogicException( |
510 | - sprintf("Can't override '%s' because the class '%s' MUST extend '%s'", $driverName, $className, self::CORE_DRIVER_NAMESPACE . $driverName . '\\Driver') |
|
510 | + sprintf("Can't override '%s' because the class '%s' MUST extend '%s'", $driverName, $className, self::CORE_DRIVER_NAMESPACE . $driverName . '\\Driver') |
|
511 | 511 | ); |
512 | 512 | } |
513 | 513 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache; |
17 | 17 | |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | 'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead', |
119 | 119 | E_USER_DEPRECATED |
120 | 120 | ); |
121 | - }elseif ($config === null){ |
|
121 | + }elseif ($config === null) { |
|
122 | 122 | $config = self::getDefaultConfig(); |
123 | - }else if(!($config instanceof ConfigurationOption)){ |
|
123 | + } else if (!($config instanceof ConfigurationOption)) { |
|
124 | 124 | throw new PhpfastcacheInvalidArgumentException(\sprintf('Unsupported config type: %s', gettype($config))); |
125 | 125 | } |
126 | 126 | |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | |
133 | 133 | $instance = $instanceId ?: md5($driver . \serialize($config->toArray())); |
134 | 134 | |
135 | - if (!isset(self::$instances[ $instance ])) { |
|
136 | - self::$badPracticeOmeter[ $driver ] = 1; |
|
135 | + if (!isset(self::$instances[$instance])) { |
|
136 | + self::$badPracticeOmeter[$driver] = 1; |
|
137 | 137 | $driverClass = self::getDriverClass($driver); |
138 | 138 | |
139 | - if(!is_a($driverClass, ExtendedCacheItemPoolInterface::class, true)){ |
|
139 | + if (!is_a($driverClass, ExtendedCacheItemPoolInterface::class, true)) { |
|
140 | 140 | throw new PhpfastcacheDriverException(sprintf( |
141 | 141 | 'Class "%s" does not implement "%s"', |
142 | 142 | $driverClass, |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | try { |
147 | 147 | if (\class_exists($driverClass)) { |
148 | 148 | $configClass = $driverClass::getConfigClass(); |
149 | - self::$instances[ $instance ] = new $driverClass(new $configClass($config->toArray()), $instance); |
|
150 | - self::$instances[ $instance ]->setEventManager(EventManager::getInstance()); |
|
149 | + self::$instances[$instance] = new $driverClass(new $configClass($config->toArray()), $instance); |
|
150 | + self::$instances[$instance]->setEventManager(EventManager::getInstance()); |
|
151 | 151 | } else { |
152 | 152 | throw new PhpfastcacheDriverNotFoundException(\sprintf('The driver "%s" does not exists', $driver)); |
153 | 153 | } |
@@ -165,14 +165,14 @@ discard block |
||
165 | 165 | throw new PhpfastcacheDriverCheckException($e->getMessage(), $e->getCode(), $e); |
166 | 166 | } |
167 | 167 | } |
168 | - } else if (self::$badPracticeOmeter[ $driver ] >= 2) { |
|
168 | + } else if (self::$badPracticeOmeter[$driver] >= 2) { |
|
169 | 169 | trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances. |
170 | 170 | See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F'); |
171 | 171 | } |
172 | 172 | |
173 | - self::$badPracticeOmeter[ $driver ]++; |
|
173 | + self::$badPracticeOmeter[$driver]++; |
|
174 | 174 | |
175 | - return self::$instances[ $instance ]; |
|
175 | + return self::$instances[$instance]; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | throw new PhpfastcacheInvalidArgumentException('The Instance ID must be a string'); |
190 | 190 | } |
191 | 191 | |
192 | - if (isset(self::$instances[ $instanceId ])) { |
|
193 | - return self::$instances[ $instanceId ]; |
|
192 | + if (isset(self::$instances[$instanceId])) { |
|
193 | + return self::$instances[$instanceId]; |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | throw new PhpfastcacheInstanceNotFoundException(\sprintf('Instance ID %s not found', $instanceId)); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | if ($autoDriver === null) { |
239 | 239 | foreach (self::getDriverList() as $driver) { |
240 | 240 | /** @var ExtendedCacheItemPoolInterface $driver */ |
241 | - if((self::CORE_DRIVER_NAMESPACE . $driver . '\Driver')::isUsableInAutoContext()){ |
|
241 | + if ((self::CORE_DRIVER_NAMESPACE . $driver . '\Driver')::isUsableInAutoContext()) { |
|
242 | 242 | try { |
243 | 243 | self::getInstance($driver, $config); |
244 | 244 | $autoDriver = $driver; |
@@ -250,11 +250,11 @@ discard block |
||
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
253 | - if(!$autoDriver || !\is_string($autoDriver)){ |
|
253 | + if (!$autoDriver || !\is_string($autoDriver)) { |
|
254 | 254 | throw new PhpfastcacheLogicException('Unable to find out a valid driver automatically'); |
255 | 255 | } |
256 | 256 | |
257 | - self::$badPracticeOmeter[ $autoDriver ]--; |
|
257 | + self::$badPracticeOmeter[$autoDriver]--; |
|
258 | 258 | |
259 | 259 | return $autoDriver; |
260 | 260 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | */ |
267 | 267 | public static function __callStatic(string $name, array $arguments): ExtendedCacheItemPoolInterface |
268 | 268 | { |
269 | - $options = (\array_key_exists(0, $arguments) && \is_array($arguments) ? $arguments[ 0 ] : []); |
|
269 | + $options = (\array_key_exists(0, $arguments) && \is_array($arguments) ? $arguments[0] : []); |
|
270 | 270 | |
271 | 271 | return self::getInstance($name, $options); |
272 | 272 | } |
@@ -378,14 +378,14 @@ discard block |
||
378 | 378 | { |
379 | 379 | static $driverList; |
380 | 380 | |
381 | - if(self::getDefaultNamespacePath() === self::getNamespacePath()){ |
|
382 | - if($driverList === null){ |
|
381 | + if (self::getDefaultNamespacePath() === self::getNamespacePath()) { |
|
382 | + if ($driverList === null) { |
|
383 | 383 | $prefix = self::CORE_DRIVER_NAMESPACE; |
384 | 384 | $classMap = self::createClassMap(__DIR__ . '/Drivers'); |
385 | 385 | $driverList = []; |
386 | 386 | |
387 | 387 | foreach ($classMap as $class => $file) { |
388 | - $driverList[] = str_replace($prefix, '', substr($class, 0, strrpos($class, '\\') )); |
|
388 | + $driverList[] = str_replace($prefix, '', substr($class, 0, strrpos($class, '\\'))); |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | $driverList = array_values(array_unique($driverList)); |
@@ -416,11 +416,11 @@ discard block |
||
416 | 416 | */ |
417 | 417 | public static function getDriverClass(string $driverName): string |
418 | 418 | { |
419 | - if(!empty(self::$driverCustoms[$driverName])){ |
|
419 | + if (!empty(self::$driverCustoms[$driverName])) { |
|
420 | 420 | $driverClass = self::$driverCustoms[$driverName]; |
421 | - }else if(!empty(self::$driverOverrides[$driverName])){ |
|
421 | + } else if (!empty(self::$driverOverrides[$driverName])) { |
|
422 | 422 | $driverClass = self::$driverOverrides[$driverName]; |
423 | - } else{ |
|
423 | + } else { |
|
424 | 424 | $driverClass = self::getNamespacePath() . $driverName . '\Driver'; |
425 | 425 | } |
426 | 426 | |
@@ -435,24 +435,24 @@ discard block |
||
435 | 435 | * @throws \Phpfastcache\Exceptions\PhpfastcacheUnsupportedOperationException |
436 | 436 | * @return void |
437 | 437 | */ |
438 | - public static function addCustomDriver(string $driverName, string $className){ |
|
438 | + public static function addCustomDriver(string $driverName, string $className) { |
|
439 | 439 | $driverName = self::standardizeDriverName($driverName); |
440 | 440 | |
441 | - if(empty($driverName)){ |
|
441 | + if (empty($driverName)) { |
|
442 | 442 | throw new PhpfastcacheInvalidArgumentException("Can't add a custom driver because its name is empty"); |
443 | 443 | } |
444 | 444 | |
445 | - if(!\class_exists($className)){ |
|
445 | + if (!\class_exists($className)) { |
|
446 | 446 | throw new PhpfastcacheInvalidArgumentException( |
447 | 447 | sprintf("Can't add '%s' because the class '%s' does not exists", $driverName, $className) |
448 | 448 | ); |
449 | 449 | } |
450 | 450 | |
451 | - if(!empty(self::$driverCustoms[$driverName])){ |
|
451 | + if (!empty(self::$driverCustoms[$driverName])) { |
|
452 | 452 | throw new PhpfastcacheLogicException(sprintf("Driver '%s' has been already added", $driverName)); |
453 | 453 | } |
454 | 454 | |
455 | - if(\in_array($driverName, self::getDriverList(), true)){ |
|
455 | + if (\in_array($driverName, self::getDriverList(), true)) { |
|
456 | 456 | throw new PhpfastcacheLogicException(sprintf("Driver '%s' is already a part of the PhpFastCache core", $driverName)); |
457 | 457 | } |
458 | 458 | |
@@ -469,11 +469,11 @@ discard block |
||
469 | 469 | { |
470 | 470 | $driverName = self::standardizeDriverName($driverName); |
471 | 471 | |
472 | - if(empty($driverName)){ |
|
472 | + if (empty($driverName)) { |
|
473 | 473 | throw new PhpfastcacheInvalidArgumentException("Can't remove a custom driver because its name is empty"); |
474 | 474 | } |
475 | 475 | |
476 | - if(!isset(self::$driverCustoms[$driverName])){ |
|
476 | + if (!isset(self::$driverCustoms[$driverName])) { |
|
477 | 477 | throw new PhpfastcacheLogicException(sprintf("Driver '%s' does not exists", $driverName)); |
478 | 478 | } |
479 | 479 | |
@@ -488,28 +488,28 @@ discard block |
||
488 | 488 | * @throws \Phpfastcache\Exceptions\PhpfastcacheUnsupportedOperationException |
489 | 489 | * @return void |
490 | 490 | */ |
491 | - public static function addCoreDriverOverride(string $driverName, string $className){ |
|
491 | + public static function addCoreDriverOverride(string $driverName, string $className) { |
|
492 | 492 | $driverName = self::standardizeDriverName($driverName); |
493 | 493 | |
494 | - if(empty($driverName)){ |
|
494 | + if (empty($driverName)) { |
|
495 | 495 | throw new PhpfastcacheInvalidArgumentException("Can't add a core driver override because its name is empty"); |
496 | 496 | } |
497 | 497 | |
498 | - if(!\class_exists($className)){ |
|
498 | + if (!\class_exists($className)) { |
|
499 | 499 | throw new PhpfastcacheInvalidArgumentException( |
500 | 500 | sprintf("Can't override '%s' because the class '%s' does not exists", $driverName, $className) |
501 | 501 | ); |
502 | 502 | } |
503 | 503 | |
504 | - if(!empty(self::$driverOverrides[$driverName])){ |
|
504 | + if (!empty(self::$driverOverrides[$driverName])) { |
|
505 | 505 | throw new PhpfastcacheLogicException(sprintf("Driver '%s' has been already overridden", $driverName)); |
506 | 506 | } |
507 | 507 | |
508 | - if(!\in_array($driverName, self::getDriverList(), true)){ |
|
508 | + if (!\in_array($driverName, self::getDriverList(), true)) { |
|
509 | 509 | throw new PhpfastcacheLogicException(sprintf("Driver '%s' can't be overridden since its not a part of the PhpFastCache core", $driverName)); |
510 | 510 | } |
511 | 511 | |
512 | - if(!\is_subclass_of($className, self::CORE_DRIVER_NAMESPACE . $driverName . '\\Driver', true)){ |
|
512 | + if (!\is_subclass_of($className, self::CORE_DRIVER_NAMESPACE . $driverName . '\\Driver', true)) { |
|
513 | 513 | throw new PhpfastcacheLogicException( |
514 | 514 | sprintf("Can't override '%s' because the class '%s' MUST extend '%s'", $driverName, $className, self::CORE_DRIVER_NAMESPACE . $driverName . '\\Driver') |
515 | 515 | ); |
@@ -528,11 +528,11 @@ discard block |
||
528 | 528 | { |
529 | 529 | $driverName = self::standardizeDriverName($driverName); |
530 | 530 | |
531 | - if(empty($driverName)){ |
|
531 | + if (empty($driverName)) { |
|
532 | 532 | throw new PhpfastcacheInvalidArgumentException("Can't remove a core driver override because its name is empty"); |
533 | 533 | } |
534 | 534 | |
535 | - if(!isset(self::$driverOverrides[$driverName])){ |
|
535 | + if (!isset(self::$driverOverrides[$driverName])) { |
|
536 | 536 | throw new PhpfastcacheLogicException(sprintf("Driver '%s' were not overridden", $driverName)); |
537 | 537 | } |
538 | 538 |