@@ -82,10 +82,8 @@ public function run(Import $import, ?Entity $parent = null): Entity
8282 $ entity = $ this ->importBook ($ exportModel , $ reader );
8383 } else if ($ exportModel instanceof ZipExportChapter) {
8484 $ entity = $ this ->importChapter ($ exportModel , $ parent , $ reader );
85- } else if ($ exportModel instanceof ZipExportPage) {
86- $ entity = $ this ->importPage ($ exportModel , $ parent , $ reader );
8785 } else {
88- throw new ZipImportException ([ ' No importable data found in import data. ' ] );
86+ $ entity = $ this -> importPage ( $ exportModel , $ parent , $ reader );
8987 }
9088
9189 $ this ->references ->replaceReferences ();
@@ -132,7 +130,7 @@ protected function importBook(ZipExportBook $exportBook, ZipExportReader $reader
132130 'name ' => $ exportBook ->name ,
133131 'description_html ' => $ exportBook ->description_html ?? '' ,
134132 'image ' => $ exportBook ->cover ? $ this ->zipFileToUploadedFile ($ exportBook ->cover , $ reader ) : null ,
135- 'tags ' => $ this ->exportTagsToInputArray ($ exportBook ->tags ?? [] ),
133+ 'tags ' => $ this ->exportTagsToInputArray ($ exportBook ->tags ),
136134 ]);
137135
138136 if ($ book ->coverInfo ()->getImage ()) {
@@ -151,7 +149,7 @@ protected function importBook(ZipExportBook $exportBook, ZipExportReader $reader
151149 foreach ($ children as $ child ) {
152150 if ($ child instanceof ZipExportChapter) {
153151 $ this ->importChapter ($ child , $ book , $ reader );
154- } else if ( $ child instanceof ZipExportPage) {
152+ } else {
155153 $ this ->importPage ($ child , $ book , $ reader );
156154 }
157155 }
@@ -166,7 +164,7 @@ protected function importChapter(ZipExportChapter $exportChapter, Book $parent,
166164 $ chapter = $ this ->chapterRepo ->create ([
167165 'name ' => $ exportChapter ->name ,
168166 'description_html ' => $ exportChapter ->description_html ?? '' ,
169- 'tags ' => $ this ->exportTagsToInputArray ($ exportChapter ->tags ?? [] ),
167+ 'tags ' => $ this ->exportTagsToInputArray ($ exportChapter ->tags ),
170168 ], $ parent );
171169
172170 $ exportPages = $ exportChapter ->pages ;
@@ -199,7 +197,7 @@ protected function importPage(ZipExportPage $exportPage, Book|Chapter $parent, Z
199197 'name ' => $ exportPage ->name ,
200198 'markdown ' => $ exportPage ->markdown ?? '' ,
201199 'html ' => $ exportPage ->html ?? '' ,
202- 'tags ' => $ this ->exportTagsToInputArray ($ exportPage ->tags ?? [] ),
200+ 'tags ' => $ this ->exportTagsToInputArray ($ exportPage ->tags ),
203201 ]);
204202
205203 $ this ->references ->addPage ($ page , $ exportPage );
@@ -302,7 +300,7 @@ protected function ensurePermissionsPermitImport(ZipExportPage|ZipExportChapter|
302300 array_push ($ chapters , ...$ exportModel ->chapters );
303301 } else if ($ exportModel instanceof ZipExportChapter) {
304302 $ chapters [] = $ exportModel ;
305- } else if ( $ exportModel instanceof ZipExportPage) {
303+ } else {
306304 $ pages [] = $ exportModel ;
307305 }
308306
0 commit comments