*/ public function all(): array { /** @var array> $targets */ $targets = (array) config('deployment.targets', []); $resolved = []; foreach ($targets as $key => $target) { $resolved[$key] = array_merge( ['label' => $key, 'domain' => '', 'remote_path' => '', 'expected_branch' => null], $target, ['key' => $key], ); } return $resolved; } /** * @return array{key:string, label:string, domain:string, remote_path:string, expected_branch:?string}|null */ public function find(?string $key): ?array { return $key ? ($this->all()[$key] ?? null) : null; } /** * @return array */ public function options(): array { return array_map(fn (array $target): string => $target['label'], $this->all()); } public function defaultKey(): ?string { return array_key_first($this->all()); } }