Completed
Push — master ( 7161cd...80db05 )
by Schlaefer
14s
created
plugins/Sitemap/src/Lib/SitemapCollection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
      */
43 43
     protected function _add($name, Controller $Controller)
44 44
     {
45
-        $name = 'Sitemap\\Lib\\' . $name;
45
+        $name = 'Sitemap\\Lib\\'.$name;
46 46
         $this->_Generators[$name] = new $name($Controller);
47 47
     }
48 48
 
Please login to merge, or discard this patch.
plugins/ImageUploader/tests/TestCase/Controller/ThumbnailControllerTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         $Uploads = TableRegistry::get('ImageUploader.Uploads');
33 33
         $upload = $Uploads->get(1);
34 34
 
35
-        $file = new File(Configure::read('Saito.Settings.uploadDirectory') . $upload->get('name'));
35
+        $file = new File(Configure::read('Saito.Settings.uploadDirectory').$upload->get('name'));
36 36
         $raw = (new SimpleImage())
37 37
             ->fromNew(500, 500, 'blue')
38 38
             ->toString($upload->get('type'));
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
         $this->assertFalse(Cache::read($upload->get('id'), 'uploadsThumbnails'));
44 44
 
45
-        $this->get('/api/v2/uploads/thumb/1?h=' . $upload->get('hash'));
45
+        $this->get('/api/v2/uploads/thumb/1?h='.$upload->get('hash'));
46 46
 
47 47
         $cache = Cache::read($upload->get('id'), 'uploadsThumbnails');
48 48
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         $this->assertSame(300, imagesx($image));
51 51
         $this->assertSame(300, imagesy($image));
52 52
         $this->assertSame($upload->get('type'), $cache['type']);
53
-        $this->assertResponseEquals($cache['raw'], (string)$this->_response->getBody());
53
+        $this->assertResponseEquals($cache['raw'], (string) $this->_response->getBody());
54 54
         $this->assertHeader('content-type', 'image/png');
55 55
 
56 56
         //// cleanup
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         $Uploads = TableRegistry::get('ImageUploader.Uploads');
70 70
         $upload = $Uploads->get(1);
71 71
 
72
-        $file = new File(Configure::read('Saito.Settings.uploadDirectory') . $upload->get('name'));
72
+        $file = new File(Configure::read('Saito.Settings.uploadDirectory').$upload->get('name'));
73 73
         $raw = (new SimpleImage())
74 74
             ->fromNew(100, 100, 'blue')
75 75
             ->toString($upload->get('type'));
Please login to merge, or discard this patch.
plugins/ImageUploader/tests/TestCase/Controller/UploadsControllerTest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     {
46 46
         parent::setUp();
47 47
 
48
-        $this->file = new File(TMP . 'my new-upload.png');
48
+        $this->file = new File(TMP.'my new-upload.png');
49 49
         $this->mockMediaFile($this->file);
50 50
     }
51 51
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                 0 => [
74 74
                     'file' => [
75 75
                         'tmp_name' => $this->file->path,
76
-                        'name' => $this->file->name() . '.' . $this->file->ext(),
76
+                        'name' => $this->file->name().'.'.$this->file->ext(),
77 77
                         'size' => $this->file->size(),
78 78
                         'type' => $this->file->mime(),
79 79
                     ]
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         ];
83 83
         $this->post('api/v2/uploads.json', $data);
84 84
 
85
-        $response = json_decode((string)$this->_response->getBody(), true);
85
+        $response = json_decode((string) $this->_response->getBody(), true);
86 86
 
87 87
         $this->assertResponseCode(200);
88 88
 
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
     {
113 113
         $this->loginJwt(1);
114 114
         unset($this->file);
115
-        $this->file = new File(TMP . 'tmp_exif.jpg');
115
+        $this->file = new File(TMP.'tmp_exif.jpg');
116 116
 
117
-        $fixture = new File($path = Plugin::path('ImageUploader') . 'tests/Fixture/exif-with-location.jpg');
117
+        $fixture = new File($path = Plugin::path('ImageUploader').'tests/Fixture/exif-with-location.jpg');
118 118
         $fixture->copy($this->file->path);
119 119
 
120
-        $readExif = function (File $file) {
120
+        $readExif = function(File $file) {
121 121
             //@codingStandardsIgnoreStart
122 122
             return @exif_read_data($file->path);
123 123
             //@codingStandardsIgnoreEnd
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
                 0 => [
133 133
                     'file' => [
134 134
                         'tmp_name' => $this->file->path,
135
-                        'name' => $this->file->name() . '.' . $this->file->ext(),
135
+                        'name' => $this->file->name().'.'.$this->file->ext(),
136 136
                         'size' => $this->file->size(),
137 137
                         'type' => $this->file->mime(),
138 138
                     ]
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         ];
142 142
         $this->post('api/v2/uploads.json', $data);
143 143
 
144
-        $response = json_decode((string)$this->_response->getBody(), true);
144
+        $response = json_decode((string) $this->_response->getBody(), true);
145 145
 
146 146
         $this->assertResponseCode(200);
147 147
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 
223 223
         $this->get('api/v2/uploads');
224 224
 
225
-        $response = json_decode((string)$this->_response->getBody(), true);
225
+        $response = json_decode((string) $this->_response->getBody(), true);
226 226
 
227 227
         $this->assertResponseCode(200);
228 228
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 
261 261
         $this->delete('api/v2/uploads/1');
262 262
 
263
-        $response = json_decode((string)$this->_response->getBody(), true);
263
+        $response = json_decode((string) $this->_response->getBody(), true);
264 264
 
265 265
         $this->assertResponseCode(204);
266 266
 
Please login to merge, or discard this patch.
plugins/ImageUploader/config/routes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 Router::plugin(
7 7
     'ImageUploader',
8 8
     ['path' => '/api/v2'],
9
-    function (RouteBuilder $routes) {
9
+    function(RouteBuilder $routes) {
10 10
         $routes->get(
11 11
             '/uploads/thumb/:id',
12 12
             ['controller' => 'Thumbnail', 'action' => 'thumb'],
Please login to merge, or discard this patch.
plugins/ImageUploader/src/View/Helper/ImageUploaderHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
                 'id' => $image->get('id'),
41 41
                 'name' => $image->get('name'),
42 42
                 'url' => $this->Url->assetUrl(
43
-                    'useruploads/' . $image->get('name'),
43
+                    'useruploads/'.$image->get('name'),
44 44
                     ['fullBase' => true]
45 45
                 ),
46 46
                 'thumbnail_url' => $this->Url->build(
Please login to merge, or discard this patch.
plugins/ImageUploader/src/Controller/UploadsController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         }
58 58
         $data = [
59 59
             'document' => $submitted,
60
-            'name' => $this->CurrentUser->getId() . '_' . $submitted['name'],
60
+            'name' => $this->CurrentUser->getId().'_'.$submitted['name'],
61 61
             'size' => $submitted['size'],
62 62
             'type' => $submitted['type'],
63 63
             'user_id' => $this->CurrentUser->getId(),
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             throw new GenericApiException($msg);
95 95
         }
96 96
 
97
-        Cache::delete((string)$imageId, 'uploadsThumbnails');
97
+        Cache::delete((string) $imageId, 'uploadsThumbnails');
98 98
 
99 99
         $this->autoRender = false;
100 100
         $this->response = $this->response->withStatus(204);
Please login to merge, or discard this patch.
plugins/ImageUploader/src/Controller/ThumbnailController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function thumb(): Response
36 36
     {
37
-        $id = (int)$this->request->getParam('id');
38
-        ['hash' => $fingerprint, 'type' => $type, 'raw' => $raw] = Cache::remember((string)$id, function () use ($id) {
37
+        $id = (int) $this->request->getParam('id');
38
+        ['hash' => $fingerprint, 'type' => $type, 'raw' => $raw] = Cache::remember((string) $id, function() use ($id) {
39 39
             $Uploads = $this->loadModel('ImageUploader.Uploads');
40 40
             $document = $Uploads->get($id);
41 41
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             return compact('hash', 'raw', 'type');
55 55
         }, 'uploadsThumbnails');
56 56
 
57
-        $hash = (string)$this->request->getQuery('h');
57
+        $hash = (string) $this->request->getQuery('h');
58 58
         if ($hash !== $fingerprint) {
59 59
             throw new SaitoForbiddenException(
60 60
                 "Attempt to access image-thumbnail $id."
Please login to merge, or discard this patch.
plugins/ImageUploader/src/Model/Entity/Upload.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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,7 +35,7 @@  discard block
 block discarded – undo
35 35
         }
36 36
 
37 37
         $ext = array_pop($parts);
38
-        $text = Text::slug(implode('.', $parts), '_') . '.' . $ext;
38
+        $text = Text::slug(implode('.', $parts), '_').'.'.$ext;
39 39
 
40 40
         return $text;
41 41
     }
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function _getFile(): File
49 49
     {
50
-        $folderPath = rtrim(Configure::read('Saito.Settings.uploadDirectory'), DS) . DS;
51
-        return new File($folderPath . $this->get('name'));
50
+        $folderPath = rtrim(Configure::read('Saito.Settings.uploadDirectory'), DS).DS;
51
+        return new File($folderPath.$this->get('name'));
52 52
     }
53 53
 
54 54
     /**
Please login to merge, or discard this patch.
plugins/ImageUploader/src/Model/Table/UploadsTable.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
             ->notBlank('user_id')
52 52
             ->requirePresence(['name', 'size', 'type', 'user_id'], 'create');
53 53
 
54
-        $maxUploadSize = (int)Configure::read('Saito.Settings.upload_max_img_size');
54
+        $maxUploadSize = (int) Configure::read('Saito.Settings.upload_max_img_size');
55 55
         $validator->add(
56 56
             'document',
57 57
             [
58 58
                 'fileSize' => [
59
-                    'rule' => ['fileSize', '<', $maxUploadSize . 'kB'],
59
+                    'rule' => ['fileSize', '<', $maxUploadSize.'kB'],
60 60
                     'message' => __d(
61 61
                         'image_uploader',
62 62
                         'validation.error.fileSize',
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
     public function buildRules(RulesChecker $rules)
84 84
     {
85 85
         // check max allowed number of uploads per user
86
-        $nMax = (int)Configure::read('Saito.Settings.upload_max_number_of_uploads');
86
+        $nMax = (int) Configure::read('Saito.Settings.upload_max_number_of_uploads');
87 87
         $rules->add(
88
-            function (Upload $entity, array $options) use ($nMax) {
88
+            function(Upload $entity, array $options) use ($nMax) {
89 89
                 $count = $this->findByUserId($entity->get('user_id'))->count();
90 90
 
91 91
                 return $count < $nMax;
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
         $ratio = $size / $target;
206 206
         $ratio = sqrt($ratio);
207 207
 
208
-        $newwidth = (int)($width / $ratio);
209
-        $newheight = (int)($height / $ratio);
208
+        $newwidth = (int) ($width / $ratio);
209
+        $newheight = (int) ($height / $ratio);
210 210
         $destination = imagecreatetruecolor($newwidth, $newheight);
211 211
 
212 212
         $source = imagecreatefromstring($raw);
Please login to merge, or discard this patch.