From dd3454391c6b974767bb04f53b44c43ba350200f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20de=20la=20Pen=CC=83a?=
Date: Wed, 4 Sep 2024 10:23:43 +0100 Subject: [PATCH] chore: Tolerate null widget data --- src/Cdn/Monitor/ObjectIsInTemplateWidgetData.php | 6 +++++- src/Cdn/Monitor/ObjectIsInWidgetData.php | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Cdn/Monitor/ObjectIsInTemplateWidgetData.php b/src/Cdn/Monitor/ObjectIsInTemplateWidgetData.php index a6582af..d485657 100644 --- a/src/Cdn/Monitor/ObjectIsInTemplateWidgetData.php +++ b/src/Cdn/Monitor/ObjectIsInTemplateWidgetData.php @@ -40,11 +40,15 @@ protected function extractWidgetData(Entity $oEntity): object|array protected function extractDetailsFromWidgetData( array $aWidgets, array $aMappings, - object|array $aWidgetData, + object|array|null $aWidgetData, CdnObject $oObject, Entity $oEntity ): array { + if (empty($aWidgetData)) { + return []; + } + $aDetails = []; foreach ($aWidgetData as $sWidgetArea => $aData) { $aDetails = array_merge( diff --git a/src/Cdn/Monitor/ObjectIsInWidgetData.php b/src/Cdn/Monitor/ObjectIsInWidgetData.php index 26a8cb5..137fe57 100644 --- a/src/Cdn/Monitor/ObjectIsInWidgetData.php +++ b/src/Cdn/Monitor/ObjectIsInWidgetData.php @@ -133,11 +133,15 @@ protected function extractWidgetData(Entity $oEntity): object|array protected function extractDetailsFromWidgetData( array $aWidgets, array $aMappings, - object|array $aWidgetData, + object|array|null $aWidgetData, CdnObject $oObject, Entity $oEntity ): array { + if (empty($aWidgetData)) { + return []; + } + $aDetails = []; foreach ($aWidgetData as $iIndex => $oWidget) {