File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -409,12 +409,17 @@ public function buildPath(PathBuilderInterface $pathBuilder): FileInterface
409409
410410 /**
411411 * @param array $metadata Meta data
412+ * @param bool $overwrite Overwrite whole metadata instead of assoc merging.
412413 * @return \Phauthentic\Infrastructure\Storage\FileInterface
413414 */
414- public function withMetadata (array $ metadata ): FileInterface
415+ public function withMetadata (array $ metadata, bool $ overwrite = false ): FileInterface
415416 {
416417 $ that = clone $ this ;
417- $ that ->metadata = $ metadata ;
418+ if ($ overwrite ) {
419+ $ that ->metadata = $ metadata ;
420+ } else {
421+ $ that ->metadata = $ metadata + $ that ->metadata ;
422+ }
418423
419424 return $ that ;
420425 }
Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ public function toArray(): array;
160160 * @param array $metadata Metadata
161161 * @return \Phauthentic\Infrastructure\Storage\FileInterface
162162 */
163- public function withMetadata (array $ metadata ): FileInterface ;
163+ public function withMetadata (array $ metadata, bool $ overwrite = false ): FileInterface ;
164164
165165 /**
166166 * Removes all metadata
You can’t perform that action at this time.
0 commit comments