File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
backend/magic-service/app/Interfaces/KnowledgeBase/Assembler Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 1010use App \Domain \KnowledgeBase \Entity \KnowledgeBaseDocumentEntity ;
1111use App \Domain \KnowledgeBase \Entity \ValueObject \DocumentFile \ExternalDocumentFile ;
1212use App \Domain \KnowledgeBase \Entity \ValueObject \DocumentFile \Interfaces \DocumentFileInterface ;
13+ use App \Domain \KnowledgeBase \Entity \ValueObject \DocumentFile \Interfaces \ExternalDocumentFileInterface ;
14+ use App \Domain \KnowledgeBase \Entity \ValueObject \DocumentFile \Interfaces \ThirdPlatformDocumentFileInterface ;
1315use App \Domain \KnowledgeBase \Entity \ValueObject \DocumentFile \ThirdPlatformDocumentFile ;
1416use App \ErrorCode \FlowErrorCode ;
1517use App \Infrastructure \Core \Exception \ExceptionBuilder ;
@@ -73,9 +75,9 @@ public static function documentFileVOToDTO(?DocumentFileInterface $documentFile)
7375 if ($ documentFile === null ) {
7476 return null ;
7577 }
76- return match (get_class ( $ documentFile ) ) {
77- ExternalDocumentFile::class => new ExternalDocumentFileDTO ($ documentFile ->toArray ()),
78- ThirdPlatformDocumentFile::class => new ThirdPlatformDocumentFileDTO ($ documentFile ->toArray ()),
78+ return match (true ) {
79+ $ documentFile instanceof ExternalDocumentFileInterface => new ExternalDocumentFileDTO ($ documentFile ->toArray ()),
80+ $ documentFile instanceof ThirdPlatformDocumentFileInterface => new ThirdPlatformDocumentFileDTO ($ documentFile ->toArray ()),
7981 default => ExceptionBuilder::throw (FlowErrorCode::KnowledgeValidateFailed),
8082 };
8183 }
You can’t perform that action at this time.
0 commit comments