code: private function makeAttachmentObject(string $attachmentType, array $attrReferences, array $item)
      {
          $attrValues = [];
  
          foreach ($attrReferences as $attrReference) {
              $attrValues[$attrReference] = $this->getValue($attrReference, $item);
          }
  
          switch ($attachmentType) {
              case self::JSON_PHOTO_FIELD:
                  return $this->createPhoto(
                      $attrValues['photo_url'],
                      $attrValues['photo_ratio'],
                      '',
                      ''
                  );
              case self::JSON_PAGE_FIELD:
                  return $this->createPage(
                      $attrValues['page_title'],
                      $attrValues['page_body'],
                      $attrValues['page_source'],
                      $attrValues['page_order'],
                      $attrValues['page_cover'],
                      $attrValues['page_lead']
                  );
              case self::JSON_GALLERY_FIELD:
                  return $this->createGallery(
                      $attrValues['gallery_body'],
                      $attrValues['gallery_order'],
                      $attrValues['gallery_photo'],
                      $attrValues['gallery_source'],
                      $attrValues['gallery_lead']
                  );
              case self::JSON_VIDEO_FIELD:
                  return $this->createVideo(
                      $attrValues['video_body'],
                      $attrValues['video_source'],
                      $attrValues['video_order'],
                      $attrValues['video_cover'],
                      $attrValues['video_lead']
                  );
              default:
                  return null;
          }
      }
docs: Make attachment object
  @param  string $attachmentType json field of attachment
  @param  array<string> $attrReferences
  @param  array<string> $item
  @return \One\Model\Photo|\One\Model\Gallery|\One\Model\Video|\One\Model\Page|null