summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkesselb <mail@danielkesselberg.de>2021-07-12 21:23:03 +0200
committerGitHub <noreply@github.com>2021-07-12 21:23:03 +0200
commitdd4f1124422a4a9b1c267e096f1f5674759b6a94 (patch)
treeb93f7be46b46d0ea66b3d0b3dc24ece7e46d0717
parentbf4c0c75404cafb7aa263ae5a045216d23623029 (diff)
parentaf61ac6a7afca423a33e91f509d58a907981e8bd (diff)
downloadnextcloud-server-dd4f1124422a4a9b1c267e096f1f5674759b6a94.tar.gz
nextcloud-server-dd4f1124422a4a9b1c267e096f1f5674759b6a94.zip
Merge pull request #27915 from nextcloud/fix/plasm-code-alerts
Fix Psalm code scanning alerts
-rw-r--r--apps/theming/lib/IconBuilder.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/theming/lib/IconBuilder.php b/apps/theming/lib/IconBuilder.php
index 36f69e3e59f..fb6909089b5 100644
--- a/apps/theming/lib/IconBuilder.php
+++ b/apps/theming/lib/IconBuilder.php
@@ -28,7 +28,6 @@ namespace OCA\Theming;
use Imagick;
use ImagickPixel;
-use OCP\App\AppPathNotFoundException;
use OCP\Files\SimpleFS\ISimpleFile;
class IconBuilder {
@@ -202,8 +201,8 @@ class IconBuilder {
$innerHeight = ($appIconFile->getImageHeight() - $border_h * 2);
$appIconFile->adaptiveResizeImage($innerWidth, $innerHeight);
// center icon
- $offset_w = 512 / 2 - $innerWidth / 2;
- $offset_h = 512 / 2 - $innerHeight / 2;
+ $offset_w = (int)(512 / 2 - $innerWidth / 2);
+ $offset_h = (int)(512 / 2 - $innerHeight / 2);
$finalIconFile = new Imagick();
$finalIconFile->setBackgroundColor(new ImagickPixel('transparent'));
@@ -223,10 +222,14 @@ class IconBuilder {
return $finalIconFile;
}
+ /**
+ * @param $app string app name
+ * @param $image string relative path to svg file in app directory
+ * @return string|false content of a colorized svg file
+ */
public function colorSvg($app, $image) {
- try {
- $imageFile = $this->util->getAppImage($app, $image);
- } catch (AppPathNotFoundException $e) {
+ $imageFile = $this->util->getAppImage($app, $image);
+ if ($imageFile === false || $imageFile === "") {
return false;
}
$svg = file_get_contents($imageFile);