diff --git a/src/Object/Api/Mastodon/Account.php b/src/Object/Api/Mastodon/Account.php index f6e66941a..587c6ce6d 100644 --- a/src/Object/Api/Mastodon/Account.php +++ b/src/Object/Api/Mastodon/Account.php @@ -132,4 +132,20 @@ class Account extends BaseEntity $this->fields = $fields->getArrayCopy(); } + + /** + * Returns the current entity as an array + * + * @return array + */ + public function toArray() + { + $account = parent::toArray(); + + if (empty($account['moved'])) { + unset($account['moved']); + } + + return $account; + } } diff --git a/src/Object/Api/Mastodon/Status.php b/src/Object/Api/Mastodon/Status.php index cc9108fc8..2d2beb583 100644 --- a/src/Object/Api/Mastodon/Status.php +++ b/src/Object/Api/Mastodon/Status.php @@ -137,4 +137,24 @@ class Status extends BaseEntity $this->card = $card->toArray(); $this->poll = null; } + + /** + * Returns the current entity as an array + * + * @return array + */ + public function toArray() + { + $status = parent::toArray(); + + if (!$status['pinned']) { + unset($status['pinned']); + } + + if (empty($status['application']['name'])) { + unset($status['application']); + } + + return $status; + } }