topic->content->S)) { returnServerError('Failed to retrieve valid JSON data'); } $data = json_decode($jsonData->topic->content->S); // Constructing the content in an array $contentArray = []; $contentArray[] = "

Introduction

$data->introduction

"; $contentArray[] = "

Overview

$data->overview

"; $contentArray[] = "

Importance

$data->importance

"; $contentArray[] = "

Historical Context

$data->historicalContext

"; $contentArray[] = '

Use Cases

'; $contentArray[] = '

Pros

'; $contentArray[] = '

Cons

'; $contentArray[] = '

Key Takeaways

'; // Concatenate array elements into a single string $content = implode('', $contentArray); // Assigning to items $this->items[] = [ 'title' => $data->title, 'content' => $content, 'url' => self::URI, 'uid' => $jsonData->topic->id->S, ]; } }