['ActionNationType', 'ActionNationType'], 'domestic' => ['ActionSpecialDomestic', 'ActionSpecialDomestic'], 'war' => ['ActionSpecialWar', 'ActionSpecialWar'], 'personality' => ['ActionPersonality', 'ActionPersonality'], ]; $result = []; foreach ($groups as $kind => [$directory, $namespace]) { foreach (glob(__DIR__ . "/../sammo/{$directory}/*.php") ?: [] as $path) { $key = basename($path, '.php'); if ($key === 'None' || str_starts_with($key, 'che_event_') || $key === 'che_거상') { continue; } $className = "\\sammo\\{$namespace}\\{$key}"; $trait = new $className(); $result[$kind][$key] = [ 'name' => $trait->getName(), 'info' => $trait->getInfo(), ]; } ksort($result[$kind]); } echo Json::encode($result);