array_map(fn($t)=>['stylesheet'=>$t->get_stylesheet(),'name'=>$t->get('Name'),'version'=>$t->get('Version'),'description'=>$t->get('Description'),'author'=>$t->get('Author')],$themes),'total'=>count($themes)]; } public static function getActiveTheme(array $args): array { $t = wp_get_theme(); return ['name'=>$t->get('Name'),'version'=>$t->get('Version'),'stylesheet'=>$t->get_stylesheet(),'template'=>$t->get_template(),'author'=>$t->get('Author'),'description'=>$t->get('Description'),'uri'=>$t->get('ThemeURI'),'screenshot'=>$t->get_screenshot()]; } public static function switchTheme(array $args): array { $theme = wp_get_theme($args['stylesheet']); if (!$theme->exists()) throw new \RuntimeException("Theme not found: {$args['stylesheet']}"); switch_theme($args['stylesheet']); return ['stylesheet'=>$args['stylesheet'],'switched'=>true]; } }