url, image: count($data->image) > 3 ? $data->image[3]->{'#text'} : $data->image[0]->{'#text'}, bio: [ 'summary' => isset($data->bio) ? self::formatLastFmText($data->bio->summary) : '', 'full' => isset($data->bio) ? self::formatLastFmText($data->bio->content) : '', ], ); } /** @return array */ public function toArray(): array { return [ 'url' => $this->url, 'image' => $this->image, 'bio' => $this->bio, ]; } }