]> BookStack Code Mirror - bookstack/commitdiff
Applied latest styleci changes
authorDan Brown <redacted>
Mon, 1 Nov 2021 13:26:02 +0000 (13:26 +0000)
committerDan Brown <redacted>
Mon, 1 Nov 2021 13:26:02 +0000 (13:26 +0000)
app/Entities/Tools/PageContent.php
app/Http/Controllers/AttachmentController.php
app/Http/Controllers/Controller.php
app/Providers/CustomValidationServiceProvider.php
app/Uploads/ImageRepo.php
app/Uploads/ImageService.php
app/Util/WebSafeMimeSniffer.php
tests/Auth/MfaVerificationTest.php
tests/Entity/PageContentTest.php
tests/Uploads/AttachmentTest.php

index c5b17ddefbb038db62401c242340c78b0095a8a2..b1323bc68ac0f02b6f3f799a59a965c0f7953fb9 100644 (file)
@@ -149,15 +149,17 @@ class PageContent
 
     /**
      * Parse a base64 image URI into the data and extension.
+     *
      * @return array{extension: array, data: string}
      */
     protected function parseBase64ImageUri(string $uri): array
     {
         [$dataDefinition, $base64ImageData] = explode(',', $uri, 2);
         $extension = strtolower(preg_split('/[\/;]/', $dataDefinition)[1] ?? '');
+
         return [
             'extension' => $extension,
-            'data' => base64_decode($base64ImageData) ?: '',
+            'data'      => base64_decode($base64ImageData) ?: '',
         ];
     }
 
index 477640b0af9320a0140abe565349b9a85c4e4d1f..c08247dadc2ba2ef5000674a7a1a2c13d8b6c83b 100644 (file)
@@ -173,6 +173,7 @@ class AttachmentController extends Controller
 
     /**
      * Get the attachments for a specific page.
+     *
      * @throws NotFoundException
      */
     public function listForPage(int $pageId)
index 3bccdcda47bc155eab429242c3cc26a2fd728a1f..d63280a23e1d46bcdbecac9cc5fe297893e4b5f9 100644 (file)
@@ -6,7 +6,6 @@ use BookStack\Facades\Activity;
 use BookStack\Interfaces\Loggable;
 use BookStack\Model;
 use BookStack\Util\WebSafeMimeSniffer;
-use finfo;
 use Illuminate\Foundation\Bus\DispatchesJobs;
 use Illuminate\Foundation\Validation\ValidatesRequests;
 use Illuminate\Http\Exceptions\HttpResponseException;
@@ -130,8 +129,7 @@ abstract class Controller extends BaseController
      */
     protected function inlineDownloadResponse(string $content, string $fileName): Response
     {
-
-        $mime = (new WebSafeMimeSniffer)->sniff($content);
+        $mime = (new WebSafeMimeSniffer())->sniff($content);
 
         return response()->make($content, 200, [
             'Content-Type'           => $mime,
index c2c0197c7aa61935cd2164c114b8806fe416e19a..ac95099cc7a0298ba4704bee0ca38494a5ae60eb 100644 (file)
@@ -15,6 +15,7 @@ class CustomValidationServiceProvider extends ServiceProvider
     {
         Validator::extend('image_extension', function ($attribute, $value, $parameters, $validator) {
             $extension = strtolower($value->getClientOriginalExtension());
+
             return ImageService::isExtensionSupported($extension);
         });
 
index 67297f3087ee34fb856985cce586435fdee3a3df..5c6228b378df9b6bb35962eb05dcf1684c9d97bf 100644 (file)
@@ -17,7 +17,8 @@ class ImageRepo
     /**
      * ImageRepo constructor.
      */
-    public function __construct(ImageService $imageService, PermissionService $permissionService) {
+    public function __construct(ImageService $imageService, PermissionService $permissionService)
+    {
         $this->imageService = $imageService;
         $this->restrictionService = $permissionService;
     }
index 0c3dfc47d356653dda543aac2508ec63490cb9db..644269731a1b0bc1be8c28278ada4af5198d551a 100644 (file)
@@ -232,6 +232,7 @@ class ImageService
      * Get the thumbnail for an image.
      * If $keepRatio is true only the width will be used.
      * Checks the cache then storage to avoid creating / accessing the filesystem on every check.
+     *
      * @throws Exception
      * @throws InvalidArgumentException
      */
@@ -271,7 +272,7 @@ class ImageService
     {
         try {
             $thumb = $this->imageTool->make($imageData);
-        } catch (ErrorException | NotSupportedException $e) {
+        } catch (ErrorException|NotSupportedException $e) {
             throw new ImageUploadException(trans('errors.cannot_create_thumbs'));
         }
 
@@ -452,6 +453,7 @@ class ImageService
     public function streamImageFromStorageResponse(string $imageType, string $path): StreamedResponse
     {
         $disk = $this->getStorageDisk($imageType);
+
         return $disk->response($path);
     }
 
index a896bd9e523c8b821564dc985d5da64bfba13bc1..4012004fc51f0670566811c782a870dfcd81b0d3 100644 (file)
@@ -10,7 +10,6 @@ use finfo;
  */
 class WebSafeMimeSniffer
 {
-
     /**
      * @var string[]
      */
@@ -61,5 +60,4 @@ class WebSafeMimeSniffer
 
         return 'application/octet-stream';
     }
-
-}
\ No newline at end of file
+}
index ee6f3ecc83143ac52b0780ec2a2bbf76a0a2a3df..49ca6663d79c07870d0136440e2998365f755d25 100644 (file)
@@ -242,7 +242,7 @@ class MfaVerificationTest extends TestCase
     }
 
     /**
-     * @return Array<User, string, TestResponse>
+     * @return array<User, string, TestResponse>
      */
     protected function startTotpLogin(): array
     {
@@ -260,7 +260,7 @@ class MfaVerificationTest extends TestCase
     }
 
     /**
-     * @return Array<User, string, TestResponse>
+     * @return array<User, string, TestResponse>
      */
     protected function startBackupCodeLogin($codes = ['kzzu6-1pgll', 'bzxnf-plygd', 'bwdsp-ysl51', '1vo93-ioy7n', 'lf7nw-wdyka', 'xmtrd-oplac']): array
     {
index 049b47f0ec2a4b1855cf0fb1ade57a8be311f995..d3a00ebde2b82fad697a3911d63e3a8989c58c5b 100644 (file)
@@ -614,7 +614,6 @@ class PageContentTest extends TestCase
             $page->refresh();
             $this->assertStringContainsString('<img src=""', $page->html);
         }
-
     }
 
     public function test_base64_images_get_extracted_from_markdown_page_content()
index 1682577bfe6e6c8b7b2286f5ffc267f6930d49d2..abd7ca616d6a56f37b226764aedf166537f6e117 100644 (file)
@@ -9,7 +9,6 @@ use BookStack\Uploads\Attachment;
 use BookStack\Uploads\AttachmentService;
 use Illuminate\Http\UploadedFile;
 use Tests\TestCase;
-use Tests\TestResponse;
 
 class AttachmentTest extends TestCase
 {
@@ -56,6 +55,7 @@ class AttachmentTest extends TestCase
         $upload = new UploadedFile($filePath, $filename, $mimeType, null, true);
 
         $this->call('POST', '/attachments/upload', ['uploaded_to' => $page->id], [], ['file' => $upload], []);
+
         return $page->attachments()->latest()->firstOrFail();
     }
 
@@ -340,5 +340,4 @@ class AttachmentTest extends TestCase
 
         $this->deleteUploads();
     }
-
 }