@@ -50,6 +50,16 @@ final class Discover implements DiscoverContract
50
50
*/
51
51
private const PSR_HTTP_STREAM_FACTORY = '\Psr\Http\Message\StreamFactoryInterface ' ;
52
52
53
+ /**
54
+ * @var string
55
+ */
56
+ private const PSR_HTTP_UPLOADED_FILE_FACTORY = '\Psr\Http\Message\UploadedFileFactoryInterface ' ;
57
+
58
+ /**
59
+ * @var string
60
+ */
61
+ private const PSR_HTTP_URI_FACTORY = '\Psr\Http\Message\UriFactoryInterface ' ;
62
+
53
63
/**
54
64
* @var string
55
65
*/
@@ -285,6 +295,66 @@ public static function httpStreamFactory(bool $singleton = false): ?object
285
295
return self ::discover (self ::PSR_HTTP_STREAM_FACTORY );
286
296
}
287
297
298
+ public static function httpUploadedFileFactories (): array
299
+ {
300
+ $ implementationsPackage = '\PsrDiscovery\Implementations\Psr17\UploadedFileFactories ' ;
301
+
302
+ if (! class_exists ($ implementationsPackage )) {
303
+ throw new SupportPackageNotFoundException ('PSR-17 HTTP UploadedFile Factory ' , 'psr-discovery/http-factory-implementations ' );
304
+ }
305
+
306
+ self ::$ extendedCandidates [self ::PSR_HTTP_UPLOADED_FILE_FACTORY ] ??= $ implementationsPackage ::allCandidates ();
307
+
308
+ return self ::discoveries (self ::PSR_HTTP_UPLOADED_FILE_FACTORY );
309
+ }
310
+
311
+ public static function httpUploadedFileFactory (bool $ singleton = false ): ?object
312
+ {
313
+ $ implementationsPackage = '\PsrDiscovery\Implementations\Psr17\UploadedFileFactories ' ;
314
+
315
+ if (! class_exists ($ implementationsPackage )) {
316
+ throw new SupportPackageNotFoundException ('PSR-17 HTTP UploadedFile Factory ' , 'psr-discovery/http-factory-implementations ' );
317
+ }
318
+
319
+ self ::$ candidates [self ::PSR_HTTP_UPLOADED_FILE_FACTORY ] ??= $ implementationsPackage ::candidates ();
320
+
321
+ if ($ singleton ) {
322
+ return self ::singleton (self ::PSR_HTTP_UPLOADED_FILE_FACTORY );
323
+ }
324
+
325
+ return self ::discover (self ::PSR_HTTP_UPLOADED_FILE_FACTORY );
326
+ }
327
+
328
+ public static function httpUriFactories (): array
329
+ {
330
+ $ implementationsPackage = '\PsrDiscovery\Implementations\Psr17\UriFactories ' ;
331
+
332
+ if (! class_exists ($ implementationsPackage )) {
333
+ throw new SupportPackageNotFoundException ('PSR-17 HTTP Uri Factory ' , 'psr-discovery/http-factory-implementations ' );
334
+ }
335
+
336
+ self ::$ extendedCandidates [self ::PSR_HTTP_URI_FACTORY ] ??= $ implementationsPackage ::allCandidates ();
337
+
338
+ return self ::discoveries (self ::PSR_HTTP_URI_FACTORY );
339
+ }
340
+
341
+ public static function httpUriFactory (bool $ singleton = false ): ?object
342
+ {
343
+ $ implementationsPackage = '\PsrDiscovery\Implementations\Psr17\UriFactories ' ;
344
+
345
+ if (! class_exists ($ implementationsPackage )) {
346
+ throw new SupportPackageNotFoundException ('PSR-17 HTTP Uri Factory ' , 'psr-discovery/http-factory-implementations ' );
347
+ }
348
+
349
+ self ::$ candidates [self ::PSR_HTTP_URI_FACTORY ] ??= $ implementationsPackage ::candidates ();
350
+
351
+ if ($ singleton ) {
352
+ return self ::singleton (self ::PSR_HTTP_URI_FACTORY );
353
+ }
354
+
355
+ return self ::discover (self ::PSR_HTTP_URI_FACTORY );
356
+ }
357
+
288
358
public static function log (bool $ singleton = false ): ?object
289
359
{
290
360
$ implementationsPackage = '\PsrDiscovery\Implementations\Psr3\Logs ' ;
0 commit comments