From 9159c97c22122402aad1c5faa494bc957756de3d Mon Sep 17 00:00:00 2001 From: Karsten Dambekalns Date: Thu, 26 Sep 2019 23:06:50 +0200 Subject: [PATCH 1/3] BUGFIX: Check for getCopyrightNotice() method before use On Neos older than 4.2 the `Asset` has no `getCopyrightNotice()`, but since this package claims compatibility, it needs to check before calling it. Fixes #26 --- Classes/Domain/ExtractionManager.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Classes/Domain/ExtractionManager.php b/Classes/Domain/ExtractionManager.php index 42b15d9..2fe2eb3 100644 --- a/Classes/Domain/ExtractionManager.php +++ b/Classes/Domain/ExtractionManager.php @@ -68,16 +68,19 @@ protected function buildAssetMetaData(Asset $asset, MetaDataCollection $metaData $collections[] = $collectionObject->getTitle(); } - $assetDto = new Dto\Asset([ + $properties = [ 'Caption' => $asset->getCaption(), - 'CopyrightNotice' => $asset->getCopyrightNotice(), 'Identifier' => $asset->getIdentifier(), 'Title' => $asset->getTitle(), 'FileName' => $asset->getResource()->getFilename(), 'Collections' => $collections, 'Tags' => $tags, 'AssetObject' => $asset, - ]); + ]; + if (method_exists($asset, 'getCopyrightNotice')) { + $properties['CopyrightNotice'] = $asset->getCopyrightNotice(); + } + $assetDto = new Dto\Asset($properties); $metaDataCollection->set('asset', $assetDto); } From 61f3002e78585c0d06a53b9bf4c4aed954c9e74d Mon Sep 17 00:00:00 2001 From: Karsten Dambekalns Date: Fri, 27 Sep 2019 10:57:30 +0200 Subject: [PATCH 2/3] TASK: Remove native_function_invocation from .styleci.yml --- .styleci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.styleci.yml b/.styleci.yml index 867b055..254d27b 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -22,7 +22,6 @@ enabled: - modernize_types_casting - multiline_comment_opening_closing - native_function_casing - - native_function_invocation - newline_before_semicolons_chained - no_alias_functions - no_alternative_syntax From f5efecb9651113a289778e9fb46e8e1591f0138f Mon Sep 17 00:00:00 2001 From: Karsten Dambekalns Date: Fri, 27 Sep 2019 10:58:47 +0200 Subject: [PATCH 3/3] TASK: Fix justified StyleCI complaint --- Classes/Domain/ExtractionManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Domain/ExtractionManager.php b/Classes/Domain/ExtractionManager.php index 2fe2eb3..c10d0b3 100644 --- a/Classes/Domain/ExtractionManager.php +++ b/Classes/Domain/ExtractionManager.php @@ -78,7 +78,7 @@ protected function buildAssetMetaData(Asset $asset, MetaDataCollection $metaData 'AssetObject' => $asset, ]; if (method_exists($asset, 'getCopyrightNotice')) { - $properties['CopyrightNotice'] = $asset->getCopyrightNotice(); + $properties['CopyrightNotice'] = $asset->getCopyrightNotice(); } $assetDto = new Dto\Asset($properties); $metaDataCollection->set('asset', $assetDto);