@@ -41,11 +41,15 @@ public function create(
4141 string $ title ,
4242 \ilMobStakeholder $ stakeholder ,
4343 int $ from_mob_id = 0
44- ) : void {
44+ ): void {
45+ $ rid = "" ;
4546 if ($ from_mob_id > 0 ) {
4647 $ from_rid = $ this ->getRidForMobId ($ from_mob_id );
47- $ rid = $ this ->irss ->cloneContainer ($ from_rid );
48- } else {
48+ if ($ from_rid !== "" ) {
49+ $ rid = $ this ->irss ->cloneContainer ($ from_rid );
50+ }
51+ }
52+ if ($ rid === "" ) {
4953 $ rid = $ this ->irss ->createContainer (
5054 $ stakeholder ,
5155 "mob.zip "
@@ -57,7 +61,7 @@ public function create(
5761 ]);
5862 }
5963
60- public function getById (int $ id ) : ?array
64+ public function getById (int $ id ): ?array
6165 {
6266 $ set = $ this ->db ->queryF (
6367 'SELECT * FROM mob_data WHERE id = %s ' ,
@@ -76,7 +80,7 @@ public function getById(int $id) : ?array
7680 return null ;
7781 }
7882
79- public function delete (int $ id ) : void
83+ public function delete (int $ id ): void
8084 {
8185 $ this ->db ->manipulateF (
8286 'DELETE FROM mob_data WHERE id = %s ' ,
@@ -85,7 +89,7 @@ public function delete(int $id) : void
8589 );
8690 }
8791
88- protected function getRidForMobId (int $ mob_id ) : string
92+ protected function getRidForMobId (int $ mob_id ): string
8993 {
9094 $ set = $ this ->db ->queryF (
9195 "SELECT * FROM mob_data " .
@@ -99,7 +103,7 @@ protected function getRidForMobId(int $mob_id) : string
99103 return "" ;
100104 }
101105
102- public function addFileFromLegacyUpload (int $ mob_id , string $ tmp_name , string $ target_path = "" ) : void
106+ public function addFileFromLegacyUpload (int $ mob_id , string $ tmp_name , string $ target_path = "" ): void
103107 {
104108 if ($ rid = $ this ->getRidForMobId ($ mob_id )) {
105109 if ($ target_path === "" ) {
@@ -117,7 +121,7 @@ public function addFileFromUpload(
117121 int $ mob_id ,
118122 UploadResult $ result ,
119123 string $ path = "/ "
120- ) : void {
124+ ): void {
121125 if ($ rid = $ this ->getRidForMobId ($ mob_id )) {
122126 $ this ->irss ->importFileFromUploadResultToContainer (
123127 $ rid ,
@@ -127,7 +131,7 @@ public function addFileFromUpload(
127131 }
128132 }
129133
130- public function addFileFromLocal (int $ mob_id , string $ tmp_name , string $ path ) : void
134+ public function addFileFromLocal (int $ mob_id , string $ tmp_name , string $ path ): void
131135 {
132136 if ($ rid = $ this ->getRidForMobId ($ mob_id )) {
133137 $ this ->irss ->addLocalFileToContainer (
@@ -138,7 +142,7 @@ public function addFileFromLocal(int $mob_id, string $tmp_name, string $path) :
138142 }
139143 }
140144
141- public function addLocalDirectory (int $ mob_id , string $ dir ) : void
145+ public function addLocalDirectory (int $ mob_id , string $ dir ): void
142146 {
143147 if ($ rid = $ this ->getRidForMobId ($ mob_id )) {
144148 $ this ->irss ->addDirectoryToContainer (
@@ -148,20 +152,20 @@ public function addLocalDirectory(int $mob_id, string $dir) : void
148152 }
149153 }
150154
151- public function getLocalSrc (int $ mob_id , string $ location ) : string
155+ public function getLocalSrc (int $ mob_id , string $ location ): string
152156 {
153157 return $ this ->irss ->getContainerUri ($ this ->getRidForMobId ($ mob_id ), $ location );
154158 }
155159
156- public function hasLocalFile (int $ mob_id , string $ location ) : bool
160+ public function hasLocalFile (int $ mob_id , string $ location ): bool
157161 {
158162 return $ this ->irss ->hasContainerEntry ($ this ->getRidForMobId ($ mob_id ), $ location );
159163 }
160164
161165 public function getLocationStream (
162166 int $ mob_id ,
163167 string $ location
164- ) : ZIPStream {
168+ ): ZIPStream {
165169 return $ this ->irss ->getStreamOfContainerEntry (
166170 $ this ->getRidForMobId ($ mob_id ),
167171 $ location
@@ -171,8 +175,7 @@ public function getLocationStream(
171175 public function getInfoOfEntry (
172176 int $ mob_id ,
173177 string $ path
174- )
175- {
178+ ) {
176179 return $ this ->irss ->getContainerEntryInfo (
177180 $ this ->getRidForMobId ($ mob_id ),
178181 $ path
@@ -182,8 +185,7 @@ public function getInfoOfEntry(
182185 public function deliverEntry (
183186 int $ mob_id ,
184187 string $ path
185- ) : void
186- {
188+ ): void {
187189 $ this ->irss ->deliverContainerEntry (
188190 $ this ->getRidForMobId ($ mob_id ),
189191 $ path
@@ -192,15 +194,15 @@ public function deliverEntry(
192194
193195 public function getContainerPath (
194196 int $ mob_id
195- ) : string {
197+ ): string {
196198 return $ this ->irss ->getResourcePath ($ this ->getRidForMobId ($ mob_id ));
197199 }
198200
199201 public function addStream (
200202 int $ mob_id ,
201203 string $ location ,
202204 FileStream $ stream
203- ) : void {
205+ ): void {
204206 $ this ->irss ->addStreamToContainer (
205207 $ this ->getRidForMobId ($ mob_id ),
206208 $ stream ,
@@ -212,7 +214,7 @@ public function addString(
212214 int $ mob_id ,
213215 string $ location ,
214216 string $ content
215- ) : void {
217+ ): void {
216218 $ this ->irss ->addStringToContainer (
217219 $ this ->getRidForMobId ($ mob_id ),
218220 $ content ,
@@ -222,27 +224,27 @@ public function addString(
222224
223225 public function getContainerResource (
224226 int $ mob_id
225- ) : ?StorableResource {
227+ ): ?StorableResource {
226228 return $ this ->irss ->getResource ($ this ->getRidForMobId ($ mob_id ));
227229 }
228230
229231 public function getContainerResourceId (
230232 int $ mob_id
231- ) : ?ResourceIdentification {
233+ ): ?ResourceIdentification {
232234 return $ this ->irss ->getResourceIdForIdString ($ this ->getRidForMobId ($ mob_id ));
233235 }
234236
235237 public function removeLocation (
236238 int $ mob_id ,
237239 string $ location
238- ) : void {
240+ ): void {
239241 $ this ->irss ->removePathFromContainer ($ this ->getRidForMobId ($ mob_id ), $ location );
240242 }
241243
242244 public function getFilesOfPath (
243245 int $ mob_id ,
244246 string $ dir_path
245- ) : array {
247+ ): array {
246248 return $ this ->irss ->getContainerEntriesOfPath (
247249 $ this ->getRidForMobId ($ mob_id ),
248250 $ dir_path
0 commit comments