@@ -43,7 +43,7 @@ public static function onBeforeRequest($event)
4343 {
4444
4545 // Only prepare if API request
46- if (substr (Yii::$ app ->request ->pathInfo , 0 , 4 ) != 'api/ ' ) {
46+ if (! str_starts_with (Yii::$ app ->request ->pathInfo , 'api/ ' ) ) {
4747 return ;
4848 }
4949
@@ -192,72 +192,42 @@ public static function onLegalModuleUserDataExport(UserDataCollectionEvent $even
192192 {
193193 $ event ->addExportData ('user ' , UserDefinitions::getUser ($ event ->user ));
194194
195- $ event ->addExportData ('password ' , array_map (function ($ password ) {
196- return UserDefinitions::getPassword ($ password );
197- }, Password::findAll (['user_id ' => $ event ->user ->id ])));
195+ $ event ->addExportData ('password ' , array_map (UserDefinitions::getPassword (...), Password::findAll (['user_id ' => $ event ->user ->id ])));
198196
199- $ event ->addExportData ('friendship ' , array_map (function ($ friendship ) {
200- return UserDefinitions::getFriendship ($ friendship );
201- }, Friendship::findAll (['user_id ' => $ event ->user ->id ])));
197+ $ event ->addExportData ('friendship ' , array_map (UserDefinitions::getFriendship (...), Friendship::findAll (['user_id ' => $ event ->user ->id ])));
202198
203- $ event ->addExportData ('mentioning ' , array_map (function ($ mentioning ) {
204- return UserDefinitions::getMentioning ($ mentioning );
205- }, Mentioning::findAll (['user_id ' => $ event ->user ->id ])));
199+ $ event ->addExportData ('mentioning ' , array_map (UserDefinitions::getMentioning (...), Mentioning::findAll (['user_id ' => $ event ->user ->id ])));
206200
207- $ event ->addExportData ('user-follow ' , array_map (function ($ follow ) {
208- return UserDefinitions::getUserFollow ($ follow );
209- }, Follow::findAll (['user_id ' => $ event ->user ->id ])));
201+ $ event ->addExportData ('user-follow ' , array_map (UserDefinitions::getUserFollow (...), Follow::findAll (['user_id ' => $ event ->user ->id ])));
210202
211- $ event ->addExportData ('auth ' , array_map (function ($ auth ) {
212- return UserDefinitions::getUserAuth ($ auth );
213- }, Auth::findAll (['user_id ' => $ event ->user ->id ])));
203+ $ event ->addExportData ('auth ' , array_map (UserDefinitions::getUserAuth (...), Auth::findAll (['user_id ' => $ event ->user ->id ])));
214204
215- $ event ->addExportData ('group ' , array_map (function ($ group ) {
216- return UserDefinitions::getGroup ($ group );
217- }, Group::find ()
205+ $ event ->addExportData ('group ' , array_map (UserDefinitions::getGroup (...), Group::find ()
218206 ->innerJoin ('group_user ' , 'group_user.group_id = group.id ' )
219207 ->where (['group_user.user_id ' => $ event ->user ->id ])
220208 ->all ()));
221209
222- $ event ->addExportData ('post ' , array_map (function ($ post ) {
223- return PostDefinitions::getPost ($ post );
224- }, Post::findAll (['created_by ' => $ event ->user ->id ])));
210+ $ event ->addExportData ('post ' , array_map (PostDefinitions::getPost (...), Post::findAll (['created_by ' => $ event ->user ->id ])));
225211
226- $ event ->addExportData ('comment ' , array_map (function ($ comment ) {
227- return CommentDefinitions::getComment ($ comment );
228- }, Comment::findAll (['created_by ' => $ event ->user ->id ])));
212+ $ event ->addExportData ('comment ' , array_map (CommentDefinitions::getComment (...), Comment::findAll (['created_by ' => $ event ->user ->id ])));
229213
230- $ event ->addExportData ('like ' , array_map (function ($ like ) {
231- return LikeDefinitions::getLike ($ like );
232- }, Like::findAll (['created_by ' => $ event ->user ->id ])));
214+ $ event ->addExportData ('like ' , array_map (LikeDefinitions::getLike (...), Like::findAll (['created_by ' => $ event ->user ->id ])));
233215
234- $ event ->addExportData ('activity ' , array_map (function ($ activity ) {
235- return ActivityDefinitions::getActivity ($ activity );
236- }, Activity::find ()
216+ $ event ->addExportData ('activity ' , array_map (ActivityDefinitions::getActivity (...), Activity::find ()
237217 ->innerJoin ('content ' , 'activity.id = content.object_id and content.object_model = :activityClass ' , ['activityClass ' => Activity::class])
238218 ->where (['created_by ' => $ event ->user ->id ])
239219 ->all ()));
240220
241- $ event ->addExportData ('invite ' , array_map (function ($ invite ) {
242- return InviteDefinitions::getInvite ($ invite );
243- }, Invite::findAll (['created_by ' => $ event ->user ->id ])));
221+ $ event ->addExportData ('invite ' , array_map (InviteDefinitions::getInvite (...), Invite::findAll (['created_by ' => $ event ->user ->id ])));
244222
245- $ event ->addExportData ('notification ' , array_map (function ($ notification ) {
246- return NotificationDefinitions::getNotification ($ notification );
247- }, Notification::findAll (['user_id ' => $ event ->user ->id ])));
223+ $ event ->addExportData ('notification ' , array_map (NotificationDefinitions::getNotification (...), Notification::findAll (['user_id ' => $ event ->user ->id ])));
248224
249- $ event ->addExportData ('space ' , array_map (function ($ space ) {
250- return SpaceDefinitions::getSpace ($ space );
251- }, Space::findAll (['created_by ' => $ event ->user ->id ])));
225+ $ event ->addExportData ('space ' , array_map (SpaceDefinitions::getSpace (...), Space::findAll (['created_by ' => $ event ->user ->id ])));
252226
253- $ event ->addExportData ('space-membership ' , array_map (function ($ membership ) {
254- return SpaceDefinitions::getSpaceMembership ($ membership );
255- }, Membership::findAll (['user_id ' => $ event ->user ->id ])));
227+ $ event ->addExportData ('space-membership ' , array_map (SpaceDefinitions::getSpaceMembership (...), Membership::findAll (['user_id ' => $ event ->user ->id ])));
256228
257229 $ files = File::findAll (['created_by ' => $ event ->user ->id ]);
258- $ event ->addExportData ('file ' , array_map (function ($ file ) {
259- return FileDefinitions::getFile ($ file );
260- }, $ files ));
230+ $ event ->addExportData ('file ' , array_map (FileDefinitions::getFile (...), $ files ));
261231
262232 foreach ($ files as $ file ) {
263233 $ event ->addExportFile ($ file ->file_name , $ file ->store ->get ());
0 commit comments