configFile = $configFile; $this->load(); } protected string $configFile; function getConfigFile(): string { return $this->configFile; } protected ?array $data = null; protected function load(): array { if ($this->data === null) { $data = yaml::load($this->configFile); $composer =& $data["composer"]; A::ensure_array($composer); A::ensure_array($composer["profiles"]); foreach ($composer["profiles"] as $profileName) { $profile =& $composer[$profileName]; A::ensure_array($profile); $profile["link"] = boolval($profile["link"] ?? false); A::ensure_array($profile["require"]); A::ensure_array($profile["require-dev"]); } $this->data = $data; } return $this->data; } function getProfileConfig(string $profile): array { $config = $this->data["composer"][$profile] ?? null; if ($config === null) { throw new ValueException("$profile: profil invalide"); } return $config; } function print(): void { yaml::dump($this->data); } }