@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | protected function doFetch($id) |
67 | 67 | { |
68 | - if (! $this->doContains($id)) { |
|
68 | + if ( ! $this->doContains($id)) { |
|
69 | 69 | $this->missesCount += 1; |
70 | 70 | |
71 | 71 | return false; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | protected function doContains($id) |
83 | 83 | { |
84 | - if (! isset($this->data[$id])) { |
|
84 | + if ( ! isset($this->data[$id])) { |
|
85 | 85 | return false; |
86 | 86 | } |
87 | 87 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $lifetime = -1; |
37 | 37 | $filename = $this->getFilename($id); |
38 | 38 | |
39 | - if (! is_file($filename)) { |
|
39 | + if ( ! is_file($filename)) { |
|
40 | 40 | return false; |
41 | 41 | } |
42 | 42 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $lifetime = -1; |
71 | 71 | $filename = $this->getFilename($id); |
72 | 72 | |
73 | - if (! is_file($filename)) { |
|
73 | + if ( ! is_file($filename)) { |
|
74 | 74 | return false; |
75 | 75 | } |
76 | 76 | |
@@ -98,6 +98,6 @@ discard block |
||
98 | 98 | $data = serialize($data); |
99 | 99 | $filename = $this->getFilename($id); |
100 | 100 | |
101 | - return $this->writeFile($filename, $lifeTime . PHP_EOL . $data); |
|
101 | + return $this->writeFile($filename, $lifeTime.PHP_EOL.$data); |
|
102 | 102 | } |
103 | 103 | } |
@@ -77,7 +77,7 @@ |
||
77 | 77 | // no internal array function supports this sort of mapping: needs to be iterative |
78 | 78 | // this filters and combines keys in one pass |
79 | 79 | foreach ($namespacedKeys as $requestedKey => $namespacedKey) { |
80 | - if (! isset($items[$namespacedKey]) && ! array_key_exists($namespacedKey, $items)) { |
|
80 | + if ( ! isset($items[$namespacedKey]) && ! array_key_exists($namespacedKey, $items)) { |
|
81 | 81 | continue; |
82 | 82 | } |
83 | 83 |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | ['_id' => $id], |
99 | 99 | [ |
100 | 100 | '$set' => [ |
101 | - MongoDBCache::EXPIRATION_FIELD => ($lifeTime > 0 ? new UTCDateTime((time() + $lifeTime) * 1000): null), |
|
101 | + MongoDBCache::EXPIRATION_FIELD => ($lifeTime > 0 ? new UTCDateTime((time() + $lifeTime) * 1000) : null), |
|
102 | 102 | MongoDBCache::DATA_FIELD => new Binary(serialize($data), Binary::TYPE_GENERIC), |
103 | 103 | ], |
104 | 104 | ], |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | 'recordStats' => 0, |
157 | 157 | 'repl' => 0, |
158 | 158 | ])->toArray()[0]; |
159 | - $uptime = $serverStatus['uptime'] ?? null; |
|
159 | + $uptime = $serverStatus['uptime'] ?? null; |
|
160 | 160 | } catch (Exception $e) { |
161 | 161 | } |
162 | 162 |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | public function __construct($directory, $extension = '', $umask = 0002) |
73 | 73 | { |
74 | 74 | // YES, this needs to be *before* createPathIfNeeded() |
75 | - if (! is_int($umask)) { |
|
75 | + if ( ! is_int($umask)) { |
|
76 | 76 | throw new InvalidArgumentException(sprintf( |
77 | 77 | 'The umask parameter is required to be integer, was: %s', |
78 | 78 | gettype($umask) |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | } |
81 | 81 | $this->umask = $umask; |
82 | 82 | |
83 | - if (! $this->createPathIfNeeded($directory)) { |
|
83 | + if ( ! $this->createPathIfNeeded($directory)) { |
|
84 | 84 | throw new InvalidArgumentException(sprintf( |
85 | 85 | 'The directory "%s" does not exist and could not be created.', |
86 | 86 | $directory |
87 | 87 | )); |
88 | 88 | } |
89 | 89 | |
90 | - if (! is_writable($directory)) { |
|
90 | + if ( ! is_writable($directory)) { |
|
91 | 91 | throw new InvalidArgumentException(sprintf( |
92 | 92 | 'The directory "%s" is not writable.', |
93 | 93 | $directory |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | // And there is a bug in PHP (https://bugs.php.net/bug.php?id=70943) with path lengths of 259. |
143 | 143 | // So if the id in hex representation would surpass the limit, we use the hash instead. The prefix prevents |
144 | 144 | // collisions between the hash and bin2hex. |
145 | - $filename = '_' . $hash; |
|
145 | + $filename = '_'.$hash; |
|
146 | 146 | } else { |
147 | 147 | $filename = bin2hex($id); |
148 | 148 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | */ |
219 | 219 | private function createPathIfNeeded(string $path) : bool |
220 | 220 | { |
221 | - if (! is_dir($path)) { |
|
221 | + if ( ! is_dir($path)) { |
|
222 | 222 | if (@mkdir($path, 0777 & (~$this->umask), true) === false && ! is_dir($path)) { |
223 | 223 | return false; |
224 | 224 | } |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | { |
240 | 240 | $filepath = pathinfo($filename, PATHINFO_DIRNAME); |
241 | 241 | |
242 | - if (! $this->createPathIfNeeded($filepath)) { |
|
242 | + if ( ! $this->createPathIfNeeded($filepath)) { |
|
243 | 243 | return false; |
244 | 244 | } |
245 | 245 | |
246 | - if (! is_writable($filepath)) { |
|
246 | + if ( ! is_writable($filepath)) { |
|
247 | 247 | return false; |
248 | 248 | } |
249 | 249 |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | { |
76 | 76 | $item = $this->findById($id); |
77 | 77 | |
78 | - if (! $item) { |
|
78 | + if ( ! $item) { |
|
79 | 79 | return false; |
80 | 80 | } |
81 | 81 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | { |
154 | 154 | [$idField] = $fields = $this->getFields(); |
155 | 155 | |
156 | - if (! $includeData) { |
|
156 | + if ( ! $includeData) { |
|
157 | 157 | $key = array_search(static::DATA_FIELD, $fields); |
158 | 158 | unset($fields[$key]); |
159 | 159 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | { |
33 | 33 | parent::__construct($directory, $extension, $umask); |
34 | 34 | |
35 | - self::$emptyErrorHandler = static function () { |
|
35 | + self::$emptyErrorHandler = static function() { |
|
36 | 36 | }; |
37 | 37 | } |
38 | 38 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | restore_error_handler(); |
111 | 111 | |
112 | - if (! isset($value['lifetime'])) { |
|
112 | + if ( ! isset($value['lifetime'])) { |
|
113 | 113 | return null; |
114 | 114 | } |
115 | 115 |
@@ -69,7 +69,7 @@ |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | // No lifetime, use MSET |
72 | - $response = $this->client->mset(array_map(static function ($value) { |
|
72 | + $response = $this->client->mset(array_map(static function($value) { |
|
73 | 73 | return serialize($value); |
74 | 74 | }, $keysAndValues)); |
75 | 75 |
@@ -118,7 +118,7 @@ |
||
118 | 118 | { |
119 | 119 | $stats = $this->memcached->getStats(); |
120 | 120 | $servers = $this->memcached->getServerList(); |
121 | - $key = $servers[0]['host'] . ':' . $servers[0]['port']; |
|
121 | + $key = $servers[0]['host'].':'.$servers[0]['port']; |
|
122 | 122 | $stats = $stats[$key]; |
123 | 123 | |
124 | 124 | return [ |