@@ -22,8 +22,7 @@ |
||
| 22 | 22 | * @param string $message |
| 23 | 23 | * @param mixed|null $corruptedData |
| 24 | 24 | */ |
| 25 | - public function __construct(protected $message = '', protected mixed $corruptedData = null) |
|
| 26 | - { |
|
| 25 | + public function __construct(protected $message = '', protected mixed $corruptedData = null) { |
|
| 27 | 26 | parent::__construct($message); |
| 28 | 27 | } |
| 29 | 28 | } |
@@ -59,8 +59,7 @@ discard block |
||
| 59 | 59 | * @throws PhpfastcacheDriverCheckException |
| 60 | 60 | * @throws PhpfastcacheIOException |
| 61 | 61 | */ |
| 62 | - public function __construct(ConfigurationOption $config, string $instanceId, EventManagerInterface $em) |
|
| 63 | - { |
|
| 62 | + public function __construct(ConfigurationOption $config, string $instanceId, EventManagerInterface $em) { |
|
| 64 | 63 | self::checkCollision('Memcache'); |
| 65 | 64 | $this->__parentConstruct($config, $instanceId, $em); |
| 66 | 65 | } |
@@ -107,14 +106,16 @@ discard block |
||
| 107 | 106 | */ |
| 108 | 107 | if (!empty($server['path'])) { |
| 109 | 108 | $this->instance->addServer($server['path'], 0); |
| 110 | - } elseif (!empty($server['host'])) { |
|
| 109 | + } |
|
| 110 | + elseif (!empty($server['host'])) { |
|
| 111 | 111 | $this->instance->addServer($server['host'], $server['port']); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | if (!empty($server['saslUser']) && !empty($server['saslPassword'])) { |
| 115 | 115 | throw new PhpfastcacheDriverException('Unlike Memcached, Memcache does not support SASL authentication'); |
| 116 | 116 | } |
| 117 | - } catch (Exception $e) { |
|
| 117 | + } |
|
| 118 | + catch (Exception $e) { |
|
| 118 | 119 | throw new PhpfastcacheDriverConnectException( |
| 119 | 120 | sprintf( |
| 120 | 121 | 'Failed to connect to memcache host/path "%s" with the following error: %s', |
@@ -96,7 +96,8 @@ discard block |
||
| 96 | 96 | * CouchbaseBucket::get() returns a GetResult interface |
| 97 | 97 | */ |
| 98 | 98 | return $this->decodeDocument((array)$this->getCollection()->get($item->getEncodedKey())->content()); |
| 99 | - } catch (DocumentNotFoundException) { |
|
| 99 | + } |
|
| 100 | + catch (DocumentNotFoundException) { |
|
| 100 | 101 | return null; |
| 101 | 102 | } |
| 102 | 103 | } |
@@ -122,7 +123,8 @@ discard block |
||
| 122 | 123 | } |
| 123 | 124 | |
| 124 | 125 | return $results; |
| 125 | - } catch (DocumentNotFoundException) { |
|
| 126 | + } |
|
| 127 | + catch (DocumentNotFoundException) { |
|
| 126 | 128 | return []; |
| 127 | 129 | } |
| 128 | 130 | } |
@@ -143,7 +145,8 @@ discard block |
||
| 143 | 145 | (new UpsertOptions())->expiry($item->getTtl()) |
| 144 | 146 | ); |
| 145 | 147 | return true; |
| 146 | - } catch (CouchbaseException) { |
|
| 148 | + } |
|
| 149 | + catch (CouchbaseException) { |
|
| 147 | 150 | return false; |
| 148 | 151 | } |
| 149 | 152 | } |
@@ -158,9 +161,11 @@ discard block |
||
| 158 | 161 | |
| 159 | 162 | try { |
| 160 | 163 | return $this->getCollection()->remove($encodedKey)->mutationToken() !== null; |
| 161 | - } catch (DocumentNotFoundException) { |
|
| 164 | + } |
|
| 165 | + catch (DocumentNotFoundException) { |
|
| 162 | 166 | return true; |
| 163 | - } catch (CouchbaseException) { |
|
| 167 | + } |
|
| 168 | + catch (CouchbaseException) { |
|
| 164 | 169 | return false; |
| 165 | 170 | } |
| 166 | 171 | } |
@@ -175,7 +180,8 @@ discard block |
||
| 175 | 180 | try { |
| 176 | 181 | $this->getCollection()->removeMulti(array_map(fn(string $key) => $this->getEncodedKey($key), $keys)); |
| 177 | 182 | return true; |
| 178 | - } catch (CouchbaseException) { |
|
| 183 | + } |
|
| 184 | + catch (CouchbaseException) { |
|
| 179 | 185 | return false; |
| 180 | 186 | } |
| 181 | 187 | } |
@@ -51,8 +51,7 @@ |
||
| 51 | 51 | /** |
| 52 | 52 | * @return int |
| 53 | 53 | */ |
| 54 | - public function getPort() |
|
| 55 | - { |
|
| 54 | + public function getPort() { |
|
| 56 | 55 | return $this->port; |
| 57 | 56 | } |
| 58 | 57 | |
@@ -67,7 +67,8 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | try { |
| 69 | 69 | $content = $this->readFile($filePath); |
| 70 | - } catch (PhpfastcacheIOException) { |
|
| 70 | + } |
|
| 71 | + catch (PhpfastcacheIOException) { |
|
| 71 | 72 | return null; |
| 72 | 73 | } |
| 73 | 74 | |
@@ -89,7 +90,8 @@ discard block |
||
| 89 | 90 | |
| 90 | 91 | try { |
| 91 | 92 | return $this->writeFile($filePath, $data, $this->getConfig()->isSecureFileManipulation()); |
| 92 | - } catch (Exception) { |
|
| 93 | + } |
|
| 94 | + catch (Exception) { |
|
| 93 | 95 | return false; |
| 94 | 96 | } |
| 95 | 97 | } |
@@ -58,8 +58,7 @@ discard block |
||
| 58 | 58 | * @throws PhpfastcacheDriverCheckException |
| 59 | 59 | * @throws PhpfastcacheIOException |
| 60 | 60 | */ |
| 61 | - public function __construct(ConfigurationOption $config, string $instanceId, EventManagerInterface $em) |
|
| 62 | - { |
|
| 61 | + public function __construct(ConfigurationOption $config, string $instanceId, EventManagerInterface $em) { |
|
| 63 | 62 | self::checkCollision('Memcached'); |
| 64 | 63 | $this->__parentConstruct($config, $instanceId, $em); |
| 65 | 64 | } |
@@ -112,7 +111,8 @@ discard block |
||
| 112 | 111 | */ |
| 113 | 112 | if (!empty($server['path'])) { |
| 114 | 113 | $connected = $this->instance->addServer($server['path'], 0); |
| 115 | - } elseif (!empty($server['host'])) { |
|
| 114 | + } |
|
| 115 | + elseif (!empty($server['host'])) { |
|
| 116 | 116 | $connected = $this->instance->addServer($server['host'], $server['port']); |
| 117 | 117 | } |
| 118 | 118 | if (!empty($server['saslUser']) && !empty($server['saslPassword'])) { |
@@ -185,7 +185,8 @@ discard block |
||
| 185 | 185 | |
| 186 | 186 | if (is_iterable($keys)) { |
| 187 | 187 | return $keys; |
| 188 | - } else { |
|
| 188 | + } |
|
| 189 | + else { |
|
| 189 | 190 | return []; |
| 190 | 191 | } |
| 191 | 192 | } |
@@ -25,8 +25,7 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | class Item extends \Phpfastcache\Drivers\Memory\Item |
| 27 | 27 | { |
| 28 | - public function __construct(ExtendedCacheItemPoolInterface $driver, string $key, EventManagerInterface $em) |
|
| 29 | - { |
|
| 28 | + public function __construct(ExtendedCacheItemPoolInterface $driver, string $key, EventManagerInterface $em) { |
|
| 30 | 29 | trigger_error('Memstatic driver has changed its name, it is now called "Memory"', E_USER_DEPRECATED); |
| 31 | 30 | parent::__construct($driver, $key, $em); |
| 32 | 31 | } |
@@ -25,8 +25,7 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | class Driver extends \Phpfastcache\Drivers\Memory\Driver |
| 27 | 27 | { |
| 28 | - public function __construct(#[\SensitiveParameter] ConfigurationOptionInterface $config, string $instanceId, EventManagerInterface $em) |
|
| 29 | - { |
|
| 28 | + public function __construct(#[\SensitiveParameter] ConfigurationOptionInterface $config, string $instanceId, EventManagerInterface $em) { |
|
| 30 | 29 | trigger_error('Memstatic driver has changed its name, it is now called "Memory"', E_USER_DEPRECATED); |
| 31 | 30 | parent::__construct($config, $instanceId, $em); |
| 32 | 31 | } |
@@ -22,8 +22,7 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | class Config extends \Phpfastcache\Drivers\Memory\Config |
| 24 | 24 | { |
| 25 | - public function __construct(array $parameters = []) |
|
| 26 | - { |
|
| 25 | + public function __construct(array $parameters = []) { |
|
| 27 | 26 | trigger_error('Memstatic driver has changed its name, it is now called "Memory"', E_USER_DEPRECATED); |
| 28 | 27 | parent::__construct($parameters); |
| 29 | 28 | } |