@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use App\Controller\AppController; |
6 | 6 | use App\Model\Table\EntriesTable; |
7 | -use Cake\Core\Configure; |
|
8 | 7 | use Cake\Event\Event; |
9 | 8 | use Cake\Http\Exception\BadRequestException; |
10 | 9 | use Feeds\Model\Behavior\FeedsPostingBehavior; |
@@ -49,7 +49,7 @@ |
||
49 | 49 | /** |
50 | 50 | * Get RssWriter feed |
51 | 51 | * |
52 | - * @return Channel |
|
52 | + * @return Feed |
|
53 | 53 | */ |
54 | 54 | public function getFeed(): Feed |
55 | 55 | { |
@@ -14,7 +14,6 @@ |
||
14 | 14 | |
15 | 15 | use App\Lib\Model\Table\AppTable; |
16 | 16 | use Cake\Core\Configure; |
17 | -use Cake\Datasource\EntityInterface; |
|
18 | 17 | use Cake\Event\Event; |
19 | 18 | use Cake\Filesystem\File; |
20 | 19 | use Cake\ORM\RulesChecker; |
@@ -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 |
@@ -51,12 +51,12 @@ discard block |
||
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 |
||
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 |
||
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); |
@@ -13,13 +13,11 @@ |
||
13 | 13 | namespace ImageUploader\Test\TestCase\Controller; |
14 | 14 | |
15 | 15 | use Api\Error\Exception\GenericApiException; |
16 | -use Cake\Cache\Cache; |
|
17 | 16 | use Cake\Core\Configure; |
18 | 17 | use Cake\Core\Plugin; |
19 | 18 | use Cake\Filesystem\File; |
20 | 19 | use Cake\Http\Exception\UnauthorizedException; |
21 | 20 | use Cake\ORM\TableRegistry; |
22 | -use claviska\SimpleImage; |
|
23 | 21 | use Saito\Exception\SaitoForbiddenException; |
24 | 22 | use Saito\Test\IntegrationTestCase; |
25 | 23 |
@@ -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 |
@@ -45,7 +45,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -14,8 +14,6 @@ |
||
14 | 14 | |
15 | 15 | use Cake\Core\Configure; |
16 | 16 | use Cake\Datasource\ConnectionManager; |
17 | -use Cake\Datasource\ConnectionRegistry; |
|
18 | -use Cake\Event\Event; |
|
19 | 17 | use Cake\Filesystem\File; |
20 | 18 | use Cake\ORM\Table; |
21 | 19 | use Cake\ORM\TableRegistry; |
@@ -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 |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | if ($hasSettingsTable) { |
67 | 67 | $this->log('Installer found Settings-table. Moving on to Updater.', LogLevel::INFO, ['saito.install']); |
68 | 68 | //// disable installer and move on to updater instead |
69 | - (new File(CONFIG . 'installer'))->delete(); |
|
69 | + (new File(CONFIG.'installer'))->delete(); |
|
70 | 70 | |
71 | 71 | return $this->redirect('/'); |
72 | 72 | } |
@@ -13,11 +13,7 @@ |
||
13 | 13 | namespace Installer\Controller; |
14 | 14 | |
15 | 15 | use Cake\Core\Configure; |
16 | -use Cake\Event\Event; |
|
17 | 16 | use Cake\Filesystem\File; |
18 | -use Cake\I18n\I18n; |
|
19 | -use Cake\ORM\Table; |
|
20 | -use Cake\ORM\TableRegistry; |
|
21 | 17 | use Installer\Form\UpdaterStartForm; |
22 | 18 | use Installer\Lib\DbVersion; |
23 | 19 | use Psr\Log\LogLevel; |
@@ -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 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function start() |
52 | 52 | { |
53 | - $token = new File(CONFIG . 'updater'); |
|
53 | + $token = new File(CONFIG.'updater'); |
|
54 | 54 | |
55 | 55 | if ($token->exists()) { |
56 | 56 | $this->renderFailure(__d('installer', 'update.failure.explanation'), 1529737182); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | (new DbVersion($this->Settings))->set($this->saitoVersion); |
107 | 107 | $this->logCurrentState('Post upgrade state.'); |
108 | 108 | } catch (\Throwable $e) { |
109 | - $this->logCurrentState('Migration failed: ' . $e->getMessage()); |
|
109 | + $this->logCurrentState('Migration failed: '.$e->getMessage()); |
|
110 | 110 | |
111 | 111 | return $this->redirect('/'); |
112 | 112 | } |
@@ -12,7 +12,6 @@ |
||
12 | 12 | |
13 | 13 | namespace Installer\Test\TestCase\Controller; |
14 | 14 | |
15 | -use App\Model\Table\SettingsTable; |
|
16 | 15 | use Cake\Core\Configure; |
17 | 16 | use Cake\Datasource\ConnectionManager; |
18 | 17 | use Cake\Filesystem\File; |
@@ -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,7 +35,7 @@ discard block |
||
35 | 35 | public function setUp() |
36 | 36 | { |
37 | 37 | parent::setUp(); |
38 | - $this->token = new File(CONFIG . 'updater'); |
|
38 | + $this->token = new File(CONFIG.'updater'); |
|
39 | 39 | $this->dbVersion = (new DbVersion(TableRegistry::get('Settings'))); |
40 | 40 | Configure::write('Saito.updated', false); |
41 | 41 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | $this->assertResponseOk(); |
56 | 56 | $this->assertEquals('failure', $this->_controller->viewBuilder()->getTemplate()); |
57 | - $this->assertResponseContains((string)1529737182); |
|
57 | + $this->assertResponseContains((string) 1529737182); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | public function testUpdaterShowFailureNoDbVersionString() |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | $this->assertResponseOk(); |
66 | 66 | $this->assertEquals('failure', $this->_controller->viewBuilder()->getTemplate()); |
67 | - $this->assertResponseContains((string)1529737397); |
|
67 | + $this->assertResponseContains((string) 1529737397); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | public function testUpdaterShowFailureWrongDbVersionString() |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | $this->assertResponseOk(); |
76 | 76 | $this->assertEquals('failure', $this->_controller->viewBuilder()->getTemplate()); |
77 | - $this->assertResponseContains((string)1529737648); |
|
77 | + $this->assertResponseContains((string) 1529737648); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | public function testUpdaterInitMigrationsFormEmpty() |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | /** |
45 | 45 | * @param string $file filename |
46 | - * @return mixed |
|
46 | + * @return false|string |
|
47 | 47 | */ |
48 | 48 | public function content($file) |
49 | 49 | { |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | /** |
95 | 95 | * Creates name for sitemap-file |
96 | 96 | * |
97 | - * @param array $params additional name parameters |
|
97 | + * @param integer[] $params additional name parameters |
|
98 | 98 | * @return string |
99 | 99 | */ |
100 | 100 | protected function _filename($params = []) |
@@ -101,7 +101,7 @@ |
||
101 | 101 | { |
102 | 102 | $filename = "sitemap-{$this->_type}"; |
103 | 103 | if ($params) { |
104 | - $filename .= '-' . implode('-', $params); |
|
104 | + $filename .= '-'.implode('-', $params); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | return $filename; |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | /** |
168 | 168 | * time to Cake start |
169 | 169 | * |
170 | - * @return mixed |
|
170 | + * @return double |
|
171 | 171 | */ |
172 | 172 | protected static function _timeToCake() |
173 | 173 | { |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | /** |
178 | 178 | * time from cake to stopwatch |
179 | 179 | * |
180 | - * @return int |
|
180 | + * @return double |
|
181 | 181 | */ |
182 | 182 | protected static function _timeFromCakeToStopwatch() |
183 | 183 | { |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | |
142 | 142 | switch ($event) { |
143 | 143 | case 'start': |
144 | - $x = '* ' . $x; |
|
144 | + $x = '* '.$x; |
|
145 | 145 | break; |
146 | 146 | case 'stop': |
147 | - $x = '† ' . $x; |
|
147 | + $x = '† '.$x; |
|
148 | 148 | break; |
149 | 149 | } |
150 | 150 | |
@@ -208,13 +208,13 @@ discard block |
||
208 | 208 | self::start('now'); |
209 | 209 | |
210 | 210 | $out = ""; |
211 | - $out .= 'Time to Cake: ' . sprintf('%05.3f', self::_timeToCake()) . " s\n"; |
|
212 | - $out .= 'Cake bootstrap: ' . sprintf('%05.3f', self::_timeFromCakeToStopwatch()) . " s\n"; |
|
211 | + $out .= 'Time to Cake: '.sprintf('%05.3f', self::_timeToCake())." s\n"; |
|
212 | + $out .= 'Cake bootstrap: '.sprintf('%05.3f', self::_timeFromCakeToStopwatch())." s\n"; |
|
213 | 213 | |
214 | 214 | $out .= "W\tU\tW_delta\tU_delta\tMem [MB]\n"; |
215 | 215 | $_seriesIndex = 1; |
216 | 216 | foreach (self::$_events as $k => $v) { |
217 | - $out .= '<span id="stopwatch-' . $_seriesIndex++ . '" class="stopwatch-row">'; |
|
217 | + $out .= '<span id="stopwatch-'.$_seriesIndex++.'" class="stopwatch-row">'; |
|
218 | 218 | $out .= sprintf( |
219 | 219 | "%05.3f\t%05.3f\t%05.3f\t%05.3f\t%5.1f\t%s\n", |
220 | 220 | $v['wtime'], |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | ); |
266 | 266 | } |
267 | 267 | |
268 | - $out .= "\n\n" . self::printStatistic(); |
|
268 | + $out .= "\n\n".self::printStatistic(); |
|
269 | 269 | |
270 | 270 | return $out; |
271 | 271 | } |
@@ -354,10 +354,10 @@ discard block |
||
354 | 354 | */ |
355 | 355 | public static function printStatistic() |
356 | 356 | { |
357 | - return self::$_stopwatchCalls . " calls with ca " . sprintf( |
|
357 | + return self::$_stopwatchCalls." calls with ca ".sprintf( |
|
358 | 358 | "%05.3f", |
359 | 359 | self::$_stopwatchTime |
360 | - ) . ' sec overhead.'; |
|
360 | + ).' sec overhead.'; |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |