Skip to content

Commit 4814e34

Browse files
committed
fix: Run cs:fix and suppress psalm false positive
Signed-off-by: Marcel Klehr <[email protected]>
1 parent 8765878 commit 4814e34

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

lib/Service/WatermarkingService.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<?php
22

3+
/**
4+
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
5+
* SPDX-License-Identifier: AGPL-3.0-or-later
6+
*/
7+
38
namespace OCA\OpenAi\Service;
49

510
use lsolesen\pel\PelEntryUndefined;
@@ -25,15 +30,17 @@ public function markImage(string $image): string {
2530
$white = imagecolorallocate($img, 255, 255, 255);
2631
$black = imagecolorallocate($img, 0, 0, 0);
2732

28-
$w = imagefontwidth($font) * strlen($text);
29-
$h = imagefontheight($font);
33+
$w = imagefontwidth($font) * strlen($text);
34+
$h = imagefontheight($font);
3035
$px = imagesx($img) - $w - 10;
3136
$py = imagesy($img) - $h - 10;
3237

3338
// draw 1-pixel black outline by offsetting in 4 directions
3439
for ($dx = -1; $dx <= 1; $dx++) {
3540
for ($dy = -1; $dy <= 1; $dy++) {
36-
if ($dx || $dy) imagestring($img, $font, $px + $dx, $py + $dy, $text, $black);
41+
if ($dx || $dy) {
42+
imagestring($img, $font, $px + $dx, $py + $dy, $text, $black);
43+
}
3744
}
3845
}
3946
imagestring($img, $font, $px, $py, $text, $white);
@@ -87,8 +94,11 @@ public function markAudio(string $audio): string {
8794
file_put_contents($tempFile, $audio);
8895

8996
$getID3 = new \getID3;
90-
$getID3->setOption(array('encoding'=>'UTF-8'));
91-
\getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'write.php', __FILE__, true);
97+
$getID3->setOption(['encoding' => 'UTF-8']);
98+
/**
99+
* @psalm-suppress UndefinedConstant
100+
*/
101+
\getid3_lib::IncludeDependency(GETID3_INCLUDEPATH . 'write.php', __FILE__, true);
92102
$tagwriter = new \getid3_writetags();
93103
$tagwriter->filename = $tempFile;
94104
$tagwriter->tagformats = ['id3v2.4'];
@@ -103,4 +113,4 @@ public function markAudio(string $audio): string {
103113

104114
return $newAudio;
105115
}
106-
}
116+
}

0 commit comments

Comments
 (0)