1919use CPMDB \Mods \Collection \ModCollection ;
2020use CPMDB \Mods \Items \ItemCategory ;
2121use CPMDB \Mods \Items \ItemInfoInterface ;
22+ use CPMDB \Mods \Mod \Screenshots \ModScreenshotCollection ;
2223use CPMDB \Mods \Mod \SeeAlso \LinkReference ;
2324use CPMDB \Mods \Tags \TagCollection ;
2425
@@ -41,7 +42,6 @@ abstract class BaseModInfo implements ModInfoInterface
4142 protected JSONFile $ dataFile ;
4243 protected string $ uuid ;
4344 protected ArrayDataCollection $ data ;
44- protected FileInfo $ screenFile ;
4545 protected string $ dataURL ;
4646 private BaseCategory $ category ;
4747 private string $ id ;
@@ -53,12 +53,6 @@ public function __construct(string $id, BaseCategory $category, ArrayDataCollect
5353 $ this ->data = $ data ;
5454 $ this ->id = $ id ;
5555 $ this ->uuid = $ category ->getID ().'. ' .$ id ;
56-
57- $ this ->screenFile = FileInfo::factory (sprintf (
58- '%s/screens/%s.jpg ' ,
59- $ category ->getDataFolder (),
60- $ id
61- ));
6256 }
6357
6458 public function getCategory () : BaseCategory
@@ -109,19 +103,15 @@ public function getName() : string
109103 return $ this ->getRawData ()->getString (self ::KEY_MOD_NAME );
110104 }
111105
112- public function hasImage () : bool
113- {
114- return $ this ->screenFile ->exists ();
115- }
106+ private ?ModScreenshotCollection $ screenCollection = null ;
116107
117- public function getImageURL () : string
108+ public function getScreenshotCollection () : ModScreenshotCollection
118109 {
119- return $ this ->category ->getScreensURL ().'/ ' .$ this ->screenFile ->getName ();
120- }
110+ if (!isset ($ this ->screenCollection )) {
111+ $ this ->screenCollection = new ModScreenshotCollection ($ this );
112+ }
121113
122- public function getImageFile () : FileInfo
123- {
124- return $ this ->screenFile ;
114+ return $ this ->screenCollection ;
125115 }
126116
127117 private ?string $ slug = null ;
0 commit comments