File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -133,11 +133,7 @@ protected function prepare_data() : array
133133
134134 private function load_data () : ?array
135135 {
136- if (empty ($ this ->topic )) {
137- $ topic = new midcom_core_dbaproxy ($ this ->topic_id , midcom_db_topic::class);
138- } else {
139- $ topic = $ this ->topic ;
140- }
136+ $ topic = $ this ->topic ?? new midcom_core_dbaproxy ($ this ->topic_id , midcom_db_topic::class);
141137
142138 // Retrieve a NAP instance
143139 $ nap = $ this ->get_component_nap ($ topic );
Original file line number Diff line number Diff line change @@ -403,23 +403,15 @@ public static function resolve_baseclass(string|object $classname) : string
403403
404404 $ classname = ClassUtils::getRealClass ($ classname );
405405
406- if (isset ($ cached [$ classname ])) {
407- return $ cached [$ classname ];
408- }
406+ if (!isset ($ cached [$ classname ])) {
407+ $ class_instance ??= new $ classname ();
409408
410- if (!isset ($ class_instance )) {
411- $ class_instance = new $ classname ();
412- }
409+ // Check for decorators first
410+ $ parent_class = $ class_instance ->__mgdschema_class_name__ ?? $ classname ;
413411
414- // Check for decorators first
415- if (!empty ($ class_instance ->__mgdschema_class_name__ )) {
416- $ parent_class = $ class_instance ->__mgdschema_class_name__ ;
417- } else {
418- $ parent_class = $ classname ;
412+ $ cached [$ classname ] = self ::class_rewrite ($ parent_class );
419413 }
420414
421- $ cached [$ classname ] = self ::class_rewrite ($ parent_class );
422-
423415 return $ cached [$ classname ];
424416 }
425417
Original file line number Diff line number Diff line change @@ -286,11 +286,10 @@ private function _process_root_types() : array
286286 if ( ($ selected = midgard_admin_asgard_plugin::get_preference ('midgard_types ' ))
287287 && preg_match_all ('/\|([a-z0-9\.\-_]+)/ ' , $ selected , $ regs )) {
288288 $ types = array_flip ($ regs [1 ]);
289- if ($ exclude ) {
290- $ label_mapping = array_diff_key ($ label_mapping , $ types );
291- } else {
292- $ label_mapping = array_intersect_key ($ label_mapping , $ types );
293- }
289+ $ label_mapping = match ($ exclude ) {
290+ true => array_diff_key ($ label_mapping , $ types ),
291+ false => array_intersect_key ($ label_mapping , $ types )
292+ };
294293 }
295294
296295 // Get the possible regular expression
You can’t perform that action at this time.
0 commit comments