]> git.mxchange.org Git - friendica.git/commitdiff
fix errors in Object namespace
authorArt4 <art4@wlabs.de>
Sun, 17 Nov 2024 21:43:06 +0000 (21:43 +0000)
committerArt4 <art4@wlabs.de>
Sun, 17 Nov 2024 21:43:06 +0000 (21:43 +0000)
src/Object/Api/Twitter/User.php
src/Object/Image.php

index ba376263c1a8421eb5550fc1490b1d16cae8d2a0..7a3a2b4622b345f2f80cd641166a21d662e75ff2 100644 (file)
@@ -62,7 +62,7 @@ class User extends BaseDataTransferObject
        protected $default_profile;
        /** @var bool */
        protected $default_profile_image;
-       /** @var Status */
+       /** @var array */
        protected $status;
        /** @var array */
        protected $withheld_in_countries;
@@ -117,12 +117,12 @@ class User extends BaseDataTransferObject
         * @param array $publicContact         Full contact table record with uid = 0
         * @param array $apcontact             Optional full apcontact table record
         * @param array $userContact           Optional full contact table record with uid != 0
-        * @param null  $status
+        * @param array $status
         * @param bool  $include_user_entities Whether to add the entities property
         *
         * @throws InternalServerErrorException
         */
-       public function __construct(array $publicContact, array $apcontact = [], array $userContact = [], $status = null, bool $include_user_entities = true)
+       public function __construct(array $publicContact, array $apcontact = [], array $userContact = [], ?array $status = null, bool $include_user_entities = true)
        {
                $uid = $userContact['uid'] ?? 0;
 
@@ -156,7 +156,7 @@ class User extends BaseDataTransferObject
                $this->default_profile         = false;
                $this->default_profile_image   = false;
 
-               if (!empty($status)) {
+               if (is_array($status)) {
                        $this->status = $status;
                } else {
                        unset($this->status);
index 256de2f284597c30c08501b1647f90091ce2f7f0..8a06b37fbdef84860cbd7bad1cd720b911b8caab 100644 (file)
@@ -771,7 +771,7 @@ class Image
        public function getBlurHash(): string
        {
                $image = New Image($this->asString(), $this->getType(), $this->filename, false);
-               if (empty($image) || !$this->isValid()) {
+               if (!$this->isValid()) {
                        return '';
                }
 
@@ -827,6 +827,7 @@ class Image
        {
                $scaled = Images::getScalingDimensions($width, $height, 90);
                $pixels = Blurhash::decode($blurhash, $scaled['width'], $scaled['height']);
+               $draw   = null;
 
                if ($this->isImagick()) {
                        $this->image = new Imagick();
@@ -839,7 +840,7 @@ class Image
                for ($y = 0; $y < $scaled['height']; ++$y) {
                        for ($x = 0; $x < $scaled['width']; ++$x) {
                                [$r, $g, $b] = $pixels[$y][$x];
-                               if ($this->isImagick()) {
+                               if ($draw !== null) {
                                        $draw->setFillColor("rgb($r, $g, $b)");
                                        $draw->point($x, $y);
                                } else {
@@ -848,7 +849,7 @@ class Image
                        }
                }
 
-               if ($this->isImagick()) {
+               if ($draw !== null) {
                        $this->image->drawImage($draw);
                        $this->width  = $this->image->getImageWidth();
                        $this->height = $this->image->getImageHeight();