From: Michael Date: Sun, 25 Oct 2020 16:55:05 +0000 (+0000) Subject: Return 'null' on empty card X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=13b14bff91734bcf3578570d9f464aa3056e55cd;p=friendica.git Return 'null' on empty card --- diff --git a/src/Object/Api/Mastodon/Card.php b/src/Object/Api/Mastodon/Card.php index 990f6a6bfa..46aea3c280 100644 --- a/src/Object/Api/Mastodon/Card.php +++ b/src/Object/Api/Mastodon/Card.php @@ -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(); + } }