Skip to content

Commit

Permalink
add the warning and check for empty type
Browse files Browse the repository at this point in the history
  • Loading branch information
pujak17 committed Jun 17, 2024
1 parent 063ea5b commit bf36109
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/JsonLdWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit bf36109

Please sign in to comment.