@@ -5,7 +5,7 @@ |
||
5 | 5 | class Config |
6 | 6 | { |
7 | 7 | /** @const string */ |
8 | - private const DEFAULT_CONFIG_PATH = __DIR__.'/Config/server.php'; |
|
8 | + private const DEFAULT_CONFIG_PATH = __DIR__ . '/Config/server.php'; |
|
9 | 9 | |
10 | 10 | /** @var array */ |
11 | 11 | protected static $config = []; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function getUploadKey() |
186 | 186 | { |
187 | - if (!empty($this->uploadKey)) { |
|
187 | + if ( ! empty($this->uploadKey)) { |
|
188 | 188 | return $this->uploadKey; |
189 | 189 | } |
190 | 190 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | |
259 | 259 | $requestMethod = $this->getRequest()->method(); |
260 | 260 | |
261 | - if (!\in_array($requestMethod, $this->getRequest()->allowedHttpVerbs())) { |
|
261 | + if ( ! \in_array($requestMethod, $this->getRequest()->allowedHttpVerbs())) { |
|
262 | 262 | return $this->response->send(null, HttpResponse::HTTP_METHOD_NOT_ALLOWED); |
263 | 263 | } |
264 | 264 | |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | { |
322 | 322 | $key = $this->request->key(); |
323 | 323 | |
324 | - if (!$fileMeta = $this->cache->get($key)) { |
|
324 | + if ( ! $fileMeta = $this->cache->get($key)) { |
|
325 | 325 | return $this->response->send(null, HttpResponse::HTTP_NOT_FOUND); |
326 | 326 | } |
327 | 327 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | return $this->response->send(null, HttpResponse::HTTP_BAD_REQUEST); |
349 | 349 | } |
350 | 350 | |
351 | - if (!$this->verifyUploadSize()) { |
|
351 | + if ( ! $this->verifyUploadSize()) { |
|
352 | 352 | return $this->response->send(null, HttpResponse::HTTP_REQUEST_ENTITY_TOO_LARGE); |
353 | 353 | } |
354 | 354 | |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | { |
452 | 452 | $uploadKey = $this->request->key(); |
453 | 453 | |
454 | - if (!$meta = $this->cache->get($uploadKey)) { |
|
454 | + if ( ! $meta = $this->cache->get($uploadKey)) { |
|
455 | 455 | return $this->response->send(null, HttpResponse::HTTP_GONE); |
456 | 456 | } |
457 | 457 | |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | |
471 | 471 | // If upload is done, verify checksum. |
472 | 472 | if ($offset === $fileSize) { |
473 | - if (!$this->verifyChecksum($checksum, $meta['file_path'])) { |
|
473 | + if ( ! $this->verifyChecksum($checksum, $meta['file_path'])) { |
|
474 | 474 | return $this->response->send(null, self::HTTP_CHECKSUM_MISMATCH); |
475 | 475 | } |
476 | 476 | |
@@ -556,14 +556,14 @@ discard block |
||
556 | 556 | $path = explode('/', str_replace('/get', '', $this->request->path())); |
557 | 557 | $key = end($path); |
558 | 558 | |
559 | - if (!$fileMeta = $this->cache->get($key)) { |
|
559 | + if ( ! $fileMeta = $this->cache->get($key)) { |
|
560 | 560 | return $this->response->send('404 upload not found.', HttpResponse::HTTP_NOT_FOUND); |
561 | 561 | } |
562 | 562 | |
563 | 563 | $resource = $fileMeta['file_path'] ?? null; |
564 | 564 | $fileName = $fileMeta['name'] ?? null; |
565 | 565 | |
566 | - if (!$resource || !file_exists($resource)) { |
|
566 | + if ( ! $resource || ! file_exists($resource)) { |
|
567 | 567 | return $this->response->send('404 upload not found.', HttpResponse::HTTP_NOT_FOUND); |
568 | 568 | } |
569 | 569 | |
@@ -581,13 +581,13 @@ discard block |
||
581 | 581 | $fileMeta = $this->cache->get($key); |
582 | 582 | $resource = $fileMeta['file_path'] ?? null; |
583 | 583 | |
584 | - if (!$resource) { |
|
584 | + if ( ! $resource) { |
|
585 | 585 | return $this->response->send(null, HttpResponse::HTTP_NOT_FOUND); |
586 | 586 | } |
587 | 587 | |
588 | 588 | $isDeleted = $this->cache->delete($key); |
589 | 589 | |
590 | - if (!$isDeleted || !file_exists($resource)) { |
|
590 | + if ( ! $isDeleted || ! file_exists($resource)) { |
|
591 | 591 | return $this->response->send(null, HttpResponse::HTTP_GONE); |
592 | 592 | } |
593 | 593 | |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | |
681 | 681 | $checksum = base64_decode($checksum); |
682 | 682 | |
683 | - if (false === $checksum || !\in_array($checksumAlgorithm, hash_algos(), true)) { |
|
683 | + if (false === $checksum || ! \in_array($checksumAlgorithm, hash_algos(), true)) { |
|
684 | 684 | return $this->response->send(null, HttpResponse::HTTP_BAD_REQUEST); |
685 | 685 | } |
686 | 686 | |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | |
719 | 719 | $path = $this->uploadDir . '/' . $actualKey . '/'; |
720 | 720 | |
721 | - if (!file_exists($path)) { |
|
721 | + if ( ! file_exists($path)) { |
|
722 | 722 | mkdir($path); |
723 | 723 | } |
724 | 724 | |
@@ -758,11 +758,11 @@ discard block |
||
758 | 758 | foreach ($cacheKeys as $key) { |
759 | 759 | $fileMeta = $this->cache->get($key, true); |
760 | 760 | |
761 | - if (!$this->isExpired($fileMeta)) { |
|
761 | + if ( ! $this->isExpired($fileMeta)) { |
|
762 | 762 | continue; |
763 | 763 | } |
764 | 764 | |
765 | - if (!$this->cache->delete($key)) { |
|
765 | + if ( ! $this->cache->delete($key)) { |
|
766 | 766 | continue; |
767 | 767 | } |
768 | 768 | |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | |
788 | 788 | $url = $this->apiUrl; |
789 | 789 | |
790 | - if (!$url) { |
|
790 | + if ( ! $url) { |
|
791 | 791 | $url = $this->getRequest()->url(); |
792 | 792 | } |
793 | 793 |