<?php

declare(strict_types=1);

namespace App\Shared\Domain\Module;

final class ModuleRegistry
{
    /**
     * @param list<class-string> $moduleClasses
     *
     * @return list<string>
     */
    public static function ids(array $moduleClasses): array
    {
        $ids = [];
        foreach ($moduleClasses as $moduleClass) {
            if (is_a($moduleClass, ModuleInterface::class, true)) {
                $ids[] = $moduleClass::id();
            }
        }

        return $ids;
    }
}
