@@ -158,7 +158,7 @@ |
||
| 158 | 158 | /** |
| 159 | 159 | * Find a single row by ID. |
| 160 | 160 | * |
| 161 | - * @param mixed $id |
|
| 161 | + * @param string $id |
|
| 162 | 162 | * @param bool $includeData |
| 163 | 163 | * |
| 164 | 164 | * @return array|null |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | $item = $this->findById($id); |
| 90 | 90 | |
| 91 | - if (!$item) { |
|
| 91 | + if ( ! $item) { |
|
| 92 | 92 | return false; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -163,11 +163,11 @@ discard block |
||
| 163 | 163 | * |
| 164 | 164 | * @return array|null |
| 165 | 165 | */ |
| 166 | - private function findById($id, bool $includeData = true) : ?array |
|
| 166 | + private function findById($id, bool $includeData = true) : ? array |
|
| 167 | 167 | { |
| 168 | 168 | list($idField) = $fields = $this->getFields(); |
| 169 | 169 | |
| 170 | - if (!$includeData) { |
|
| 170 | + if ( ! $includeData) { |
|
| 171 | 171 | $key = array_search(static::DATA_FIELD, $fields); |
| 172 | 172 | unset($fields[$key]); |
| 173 | 173 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | // And there is a bug in PHP (https://bugs.php.net/bug.php?id=70943) with path lengths of 259. |
| 145 | 145 | // So if the id in hex representation would surpass the limit, we use the hash instead. The prefix prevents |
| 146 | 146 | // collisions between the hash and bin2hex. |
| 147 | - $filename = '_' . $hash; |
|
| 147 | + $filename = '_'.$hash; |
|
| 148 | 148 | } else { |
| 149 | 149 | $filename = bin2hex($id); |
| 150 | 150 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | { |
| 196 | 196 | $usage = 0; |
| 197 | 197 | foreach ($this->getIterator() as $name => $file) { |
| 198 | - if (! $file->isDir() && $this->isFilenameEndingWithExtension($name)) { |
|
| 198 | + if ( ! $file->isDir() && $this->isFilenameEndingWithExtension($name)) { |
|
| 199 | 199 | $usage += $file->getSize(); |
| 200 | 200 | } |
| 201 | 201 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | private function createPathIfNeeded(string $path) : bool |
| 221 | 221 | { |
| 222 | 222 | if ( ! is_dir($path)) { |
| 223 | - if (false === @mkdir($path, 0777 & (~$this->umask), true) && !is_dir($path)) { |
|
| 223 | + if (false === @mkdir($path, 0777 & (~$this->umask), true) && ! is_dir($path)) { |
|
| 224 | 224 | return false; |
| 225 | 225 | } |
| 226 | 226 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | parent::__construct($directory, $extension, $umask); |
| 45 | 45 | |
| 46 | - self::$emptyErrorHandler = function () { |
|
| 46 | + self::$emptyErrorHandler = function() { |
|
| 47 | 47 | }; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $lifeTime = time() + $lifeTime; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - $filename = $this->getFilename($id); |
|
| 91 | + $filename = $this->getFilename($id); |
|
| 92 | 92 | |
| 93 | 93 | $value = [ |
| 94 | 94 | 'lifetime' => $lifeTime, |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * |
| 112 | 112 | * @return array|null |
| 113 | 113 | */ |
| 114 | - private function includeFileForId(string $id) : ?array |
|
| 114 | + private function includeFileForId(string $id) : ? array |
|
| 115 | 115 | { |
| 116 | 116 | $fileName = $this->getFilename($id); |
| 117 | 117 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | restore_error_handler(); |
| 124 | 124 | |
| 125 | - if (! isset($value['lifetime'])) { |
|
| 125 | + if ( ! isset($value['lifetime'])) { |
|
| 126 | 126 | return null; |
| 127 | 127 | } |
| 128 | 128 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | private function getNamespacedId(string $id) : string |
| 193 | 193 | { |
| 194 | - $namespaceVersion = $this->getNamespaceVersion(); |
|
| 194 | + $namespaceVersion = $this->getNamespaceVersion(); |
|
| 195 | 195 | |
| 196 | 196 | return sprintf('%s[%s][%s]', $this->namespace, $id, $namespaceVersion); |
| 197 | 197 | } |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | $success = true; |
| 275 | 275 | |
| 276 | 276 | foreach ($keysAndValues as $key => $value) { |
| 277 | - if (!$this->doSave($key, $value, $lifetime)) { |
|
| 277 | + if ( ! $this->doSave($key, $value, $lifetime)) { |
|
| 278 | 278 | $success = false; |
| 279 | 279 | } |
| 280 | 280 | } |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | $success = true; |
| 307 | 307 | |
| 308 | 308 | foreach ($keys as $key) { |
| 309 | - if (! $this->doDelete($key)) { |
|
| 309 | + if ( ! $this->doDelete($key)) { |
|
| 310 | 310 | $success = false; |
| 311 | 311 | } |
| 312 | 312 | } |