From bf361096f802417a8a3760d87c6ce11b89f85872 Mon Sep 17 00:00:00 2001 From: puja Date: Mon, 17 Jun 2024 17:11:27 +0200 Subject: [PATCH] add the warning and check for empty type --- src/JsonLdWriter.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/JsonLdWriter.php b/src/JsonLdWriter.php index a2bc852..c9e8e6a 100644 --- a/src/JsonLdWriter.php +++ b/src/JsonLdWriter.php @@ -287,11 +287,14 @@ protected function convertImageToBinary(array|string $value): mixed } elseif (array_key_exists('@type', $value)) { // Some other form of image like a Barcode and ImageObjectSnapshot. // See: https://schema.org/ImageObject - $type = !empty($value['@type']) ? (is_string($value['@type']) ? $value['@type'] : json_encode($value['@type'])) : ''; - $this->logger->warning( - "Images of type ". $type - . " not supported. Image will not be converted." - ); + if(empty($value['@type'])){ + $this->logger->warning('@type is empty'); + } else { + $this->logger->warning( + "Images of type ". $type + . " not supported. Image will not be converted." + ); + } } else { // Array of images, so we just call this method on the first element. $firstImage = array_shift($value);