]> git.mxchange.org Git - friendica.git/commitdiff
Return 'null' on empty card
authorMichael <heluecht@pirati.ca>
Sun, 25 Oct 2020 16:55:05 +0000 (16:55 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 25 Oct 2020 16:55:05 +0000 (16:55 +0000)
src/Object/Api/Mastodon/Card.php

index 990f6a6bfa50fa45c889c6a471f4f2b391bab314..46aea3c2802bea268f55e92eb96ca0cdc9729976 100644 (file)
@@ -59,4 +59,18 @@ class Card extends BaseEntity
                $this->type        = $attachment['type'] ?? '';
                $this->image       = $attachment['image'] ?? '';
        }
+
+       /**
+        * Returns the current entity as an array
+        *
+        * @return array
+        */
+       public function toArray()
+       {
+               if (empty($this->url)) {
+                       return null;
+               }
+
+               return parent::toArray();
+       }
 }