@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | if (!empty($settings['id'])) { |
| 59 | - $this->_id = (int)$settings['id']; |
|
| 59 | + $this->_id = (int) $settings['id']; |
|
| 60 | 60 | $this->_isLoggedIn = true; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | public function isUser($user) |
| 140 | 140 | { |
| 141 | 141 | if (is_numeric($user)) { |
| 142 | - $id = (int)$user; |
|
| 142 | + $id = (int) $user; |
|
| 143 | 143 | } elseif ($user instanceof ForumsUserInterface || $user instanceof User) { |
| 144 | 144 | $id = $user->get('id'); |
| 145 | 145 | } else { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | public function isLocked(): bool |
| 158 | 158 | { |
| 159 | - return (bool)$this->get('user_lock'); |
|
| 159 | + return (bool) $this->get('user_lock'); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Saito - The Threaded Web Forum |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | public function setDefaultMaxFileSize($number): self |
| 64 | 64 | { |
| 65 | 65 | if (is_string($number)) { |
| 66 | - $number = (int)Text::parseFileSize($number, $this->defaultSize); |
|
| 66 | + $number = (int) Text::parseFileSize($number, $this->defaultSize); |
|
| 67 | 67 | } |
| 68 | 68 | if (!is_int($number)) { |
| 69 | 69 | throw new \InvalidArgumentException( |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | if ($size === null) { |
| 90 | 90 | $size = $this->defaultSize; |
| 91 | 91 | } elseif (is_string($size)) { |
| 92 | - $size = (int)Text::parseFileSize($size, $this->defaultSize); |
|
| 92 | + $size = (int) Text::parseFileSize($size, $this->defaultSize); |
|
| 93 | 93 | } |
| 94 | 94 | if (!is_int($size)) { |
| 95 | 95 | throw new \InvalidArgumentException( |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Saito - The Threaded Web Forum |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $this->loginJwt(1); |
| 73 | 73 | |
| 74 | 74 | $this->upload($this->file); |
| 75 | - $response = json_decode((string)$this->_response->getBody(), true); |
|
| 75 | + $response = json_decode((string) $this->_response->getBody(), true); |
|
| 76 | 76 | |
| 77 | 77 | $this->assertResponseCode(200); |
| 78 | 78 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | <svg width="9" height="9" style="background:red;"></svg>'); |
| 120 | 120 | $this->upload($this->file); |
| 121 | 121 | |
| 122 | - $response = json_decode((string)$this->_response->getBody(), true); |
|
| 122 | + $response = json_decode((string) $this->_response->getBody(), true); |
|
| 123 | 123 | |
| 124 | 124 | $this->assertResponseCode(200); |
| 125 | 125 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | $this->upload($this->file); |
| 178 | 178 | |
| 179 | - $response = json_decode((string)$this->_response->getBody(), true); |
|
| 179 | + $response = json_decode((string) $this->_response->getBody(), true); |
|
| 180 | 180 | |
| 181 | 181 | $this->assertResponseCode(200); |
| 182 | 182 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | $this->get('api/v2/uploads'); |
| 238 | 238 | |
| 239 | - $response = json_decode((string)$this->_response->getBody(), true); |
|
| 239 | + $response = json_decode((string) $this->_response->getBody(), true); |
|
| 240 | 240 | |
| 241 | 241 | $this->assertResponseCode(200); |
| 242 | 242 | |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | $this->delete('api/v2/uploads/1'); |
| 285 | 285 | |
| 286 | - $response = json_decode((string)$this->_response->getBody(), true); |
|
| 286 | + $response = json_decode((string) $this->_response->getBody(), true); |
|
| 287 | 287 | |
| 288 | 288 | $this->assertResponseCode(204); |
| 289 | 289 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Saito - The Threaded Web Forum |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $this->assertSame(300, imagesx($image)); |
| 56 | 56 | $this->assertSame(300, imagesy($image)); |
| 57 | 57 | $this->assertSame($upload->get('type'), $cache['type']); |
| 58 | - $this->assertResponseEquals($cache['raw'], (string)$this->_response->getBody()); |
|
| 58 | + $this->assertResponseEquals($cache['raw'], (string) $this->_response->getBody()); |
|
| 59 | 59 | $this->assertHeader('content-type', 'image/png'); |
| 60 | 60 | |
| 61 | 61 | //// cleanup |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Saito - The Threaded Web Forum |
@@ -247,8 +247,8 @@ discard block |
||
| 247 | 247 | $ratio = $size / $target; |
| 248 | 248 | $ratio = sqrt($ratio); |
| 249 | 249 | |
| 250 | - $newwidth = (int)($width / $ratio); |
|
| 251 | - $newheight = (int)($height / $ratio); |
|
| 250 | + $newwidth = (int) ($width / $ratio); |
|
| 251 | + $newheight = (int) ($height / $ratio); |
|
| 252 | 252 | $destination = imagecreatetruecolor($newwidth, $newheight); |
| 253 | 253 | |
| 254 | 254 | $source = imagecreatefromstring($raw); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Saito - The Threaded Web Forum |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function thumb(): Response |
| 37 | 37 | { |
| 38 | - $id = (int)$this->request->getParam('id'); |
|
| 39 | - ['hash' => $fingerprint, 'type' => $type, 'raw' => $raw] = Cache::remember((string)$id, function () use ($id) { |
|
| 38 | + $id = (int) $this->request->getParam('id'); |
|
| 39 | + ['hash' => $fingerprint, 'type' => $type, 'raw' => $raw] = Cache::remember((string) $id, function () use ($id) { |
|
| 40 | 40 | $Uploads = $this->loadModel('ImageUploader.Uploads'); |
| 41 | 41 | $document = $Uploads->get($id); |
| 42 | 42 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | return compact('hash', 'raw', 'type'); |
| 56 | 56 | }, Configure::read('Saito.Settings.uploader')->getCacheKey()); |
| 57 | 57 | |
| 58 | - $hash = (string)$this->request->getQuery('h'); |
|
| 58 | + $hash = (string) $this->request->getQuery('h'); |
|
| 59 | 59 | if ($hash !== $fingerprint) { |
| 60 | 60 | throw new SaitoForbiddenException( |
| 61 | 61 | "Attempt to access image-thumbnail $id." |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Saito - The Threaded Web Forum |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | throw new GenericApiException($msg); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - Cache::delete((string)$imageId, 'uploadsThumbnails'); |
|
| 106 | + Cache::delete((string) $imageId, 'uploadsThumbnails'); |
|
| 107 | 107 | |
| 108 | 108 | $this->autoRender = false; |
| 109 | 109 | $this->response = $this->response->withStatus(204); |
@@ -118,8 +118,8 @@ |
||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | $_placeholder = ' … '; |
| 121 | - $leftMargin = (int)floor($_textWordMaxLength / 2); |
|
| 122 | - $rightMargin = (int)(-1 * ($_textWordMaxLength - $leftMargin - mb_strlen($_placeholder))); |
|
| 121 | + $leftMargin = (int) floor($_textWordMaxLength / 2); |
|
| 122 | + $rightMargin = (int) (-1 * ($_textWordMaxLength - $leftMargin - mb_strlen($_placeholder))); |
|
| 123 | 123 | |
| 124 | 124 | $string = mb_substr($string, 0, $leftMargin) . $_placeholder . |
| 125 | 125 | mb_substr($string, $rightMargin); |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | } |
| 229 | 229 | $code = $this->request->getQuery('c'); |
| 230 | 230 | try { |
| 231 | - $activated = $this->Users->activate((int)$id, $code); |
|
| 231 | + $activated = $this->Users->activate((int) $id, $code); |
|
| 232 | 232 | } catch (\Exception $e) { |
| 233 | 233 | $activated = false; |
| 234 | 234 | } |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | public function ignore() |
| 287 | 287 | { |
| 288 | 288 | $this->request->allowMethod('POST'); |
| 289 | - $blockedId = (int)$this->request->getData('id'); |
|
| 289 | + $blockedId = (int) $this->request->getData('id'); |
|
| 290 | 290 | $this->_ignore($blockedId, true); |
| 291 | 291 | } |
| 292 | 292 | |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | public function unignore() |
| 299 | 299 | { |
| 300 | 300 | $this->request->allowMethod('POST'); |
| 301 | - $blockedId = (int)$this->request->getData('id'); |
|
| 301 | + $blockedId = (int) $this->request->getData('id'); |
|
| 302 | 302 | $this->_ignore($blockedId, false); |
| 303 | 303 | } |
| 304 | 304 | |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | protected function _ignore($blockedId, $set) |
| 313 | 313 | { |
| 314 | 314 | $userId = $this->CurrentUser->getId(); |
| 315 | - if ((int)$userId === (int)$blockedId) { |
|
| 315 | + if ((int) $userId === (int) $blockedId) { |
|
| 316 | 316 | throw new BadRequestException(); |
| 317 | 317 | } |
| 318 | 318 | if ($set) { |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | throw new BadRequestException; |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | - $id = (int)$this->request->getData('lockUserId'); |
|
| 537 | + $id = (int) $this->request->getData('lockUserId'); |
|
| 538 | 538 | if (!$this->Users->exists($id)) { |
| 539 | 539 | throw new NotFoundException('User does not exist.', 1524298280); |
| 540 | 540 | } |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | $this->Flash->set($message, ['element' => 'error']); |
| 549 | 549 | } else { |
| 550 | 550 | try { |
| 551 | - $duration = (int)$this->request->getData('lockPeriod'); |
|
| 551 | + $duration = (int) $this->request->getData('lockPeriod'); |
|
| 552 | 552 | $blocker = new ManualBlocker($this->CurrentUser->getId(), $duration); |
| 553 | 553 | $status = $this->Users->UserBlocks->block($blocker, $id); |
| 554 | 554 | if (!$status) { |