|
13 | 13 |
|
14 | 14 | final class Clients extends Implementation implements ClientsContract |
15 | 15 | { |
16 | | - private static ?CandidatesCollection $candidates = null; |
17 | | - private static ?ClientInterface $singleton = null; |
18 | | - private static ?ClientInterface $using = null; |
| 16 | + private static ?CandidatesCollection $candidates = null; |
| 17 | + private static ?CandidatesCollection $extendedCandidates = null; |
| 18 | + private static ?ClientInterface $singleton = null; |
| 19 | + private static ?ClientInterface $using = null; |
19 | 20 |
|
20 | 21 | public static function add(CandidateEntity $candidate): void |
21 | 22 | { |
22 | 23 | parent::add($candidate); |
23 | 24 | self::use(null); |
24 | 25 | } |
25 | 26 |
|
| 27 | + /** |
| 28 | + * @psalm-suppress MixedInferredReturnType,MixedReturnStatement |
| 29 | + */ |
| 30 | + public static function allCandidates(): CandidatesCollection |
| 31 | + { |
| 32 | + if (null !== self::$extendedCandidates) { |
| 33 | + return self::$extendedCandidates; |
| 34 | + } |
| 35 | + |
| 36 | + self::$extendedCandidates = CandidatesCollection::create(); |
| 37 | + self::$extendedCandidates->set(self::candidates()); |
| 38 | + |
| 39 | + return self::$extendedCandidates; |
| 40 | + } |
| 41 | + |
26 | 42 | /** |
27 | 43 | * @psalm-suppress MixedInferredReturnType,MixedReturnStatement |
28 | 44 | */ |
@@ -129,6 +145,11 @@ public static function discover(): ?ClientInterface |
129 | 145 | return Discover::httpClient(); |
130 | 146 | } |
131 | 147 |
|
| 148 | + public static function discoveries(): array |
| 149 | + { |
| 150 | + return Discover::httpClients(); |
| 151 | + } |
| 152 | + |
132 | 153 | public static function prefer(string $package): void |
133 | 154 | { |
134 | 155 | self::$candidates ??= CandidatesCollection::create(); |
|
0 commit comments