*/ public readonly array $reseaux; /** @var array, preparation: ?string}> */ public readonly array $machines; public static function depuis(string $identifiantLab): self { $chemin = config('labs.dossier')."/{$identifiantLab}/lab.yaml"; if (! File::exists($chemin)) { throw new RuntimeException("Lab introuvable : {$chemin}"); } $donnees = Yaml::parseFile($chemin); return new self($donnees); } private function __construct(array $donnees) { $this->identifiant = $donnees['id']; $this->reseaux = $donnees['reseaux']; $this->machines = array_map( fn (array $m) => [ 'nom' => $m['nom'], 'image' => $m['image'], 'flavor' => $m['flavor'], 'reseaux' => $m['reseaux'], 'preparation' => $m['preparation'] ?? null, ], $donnees['machines'], ); } }