src/FormatMapping.php
private function attachment(string $attachmentType, array $attributes, array $dataArticle): array
    {
        $data = $dataArticle[$attachmentType];

        $encoded = json_encode($data);

        $attachments = [];

        if ($this->filterArray($data)) {
            $decodedData = json_decode($encoded, true);

            $numberOfItems = count($decodedData);

            for ($i = 0; $i < $numberOfItems; $i++) {
                $item = $decodedData[$i];

                $attachment = $this->filterAttachmentObject(
                    $this->makeAttachmentObject(
                        $attachmentType,
                        $attributes,
                        $item
                    )
                );

                array_push($attachments, $attachment);
            }
        }

        return [
            'numberOfItems' => count($attachments),
            'attachments' => $attachments,
        ];
    }
private function attachment(string $attachmentType, array $attributes, array $dataArticle): array
    {
        $data = $dataArticle[$attachmentType];

        $encoded = json_encode($data);

        $attachments = [];

        if ($this->filterArray($data)) {
            $decodedData = json_decode($encoded, true);

            $numberOfItems = count($decodedData);

            for ($i = 0; $i < $numberOfItems; $i++) {
                $item = $decodedData[$i];

                $attachment = $this->filterAttachmentObject(
                    $this->makeAttachmentObject(
                        $attachmentType,
                        $attributes,
                        $item
                    )
                );

                array_push($attachments, $attachment);
            }
        }

        return [
            'numberOfItems' => count($attachments),
            'attachments' => $attachments,
        ];
    }
Attachment(s) of a single article
@return array attachments