add($method); } } public function add(AuthMethodInterface $authMethod): void { $this->methods[$authMethod->getSupportedMethod()] = $authMethod; } /** * @psalm-api * * @return AuthMethodInterface[] */ public function all(): array { return $this->methods; } #[Override] public function create(string $authMethod): AuthMethodInterface { $method = $this->methods[$authMethod] ?? null; if (null === $method) { throw new InvalidArgumentException('Unsupported auth method "' . $authMethod . '"'); } return $method; } }