You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -26,11 +27,18 @@ protected function buildUri($uri)
26
27
if (defined('URI_FACTORY')) {
27
28
$factoryClass = URI_FACTORY;
28
29
$factory = new$factoryClass();
29
-
if (!$factoryinstanceof \Http\Message\UriFactory) {
30
-
thrownew \RuntimeException('Constant "URI_FACTORY" must be a reference to a Http\Message\UriFactory');
30
+
if ($factoryinstanceof \Http\Message\UriFactory) {
31
+
return$factory->createUri($uri);
31
32
}
33
+
if ($factoryinstanceof \Interop\Http\Factory\UriFactoryInterface) {
34
+
if ($uriinstanceof UriInterface) {
35
+
return$uri;
36
+
}
32
37
33
-
return$factory->createUri($uri);
38
+
return$factory->createUri($uri);
39
+
}
40
+
41
+
thrownew \RuntimeException('Constant "URI_FACTORY" must be a reference to a Http\Message\UriFactory or \Interop\Http\Factory\UriFactoryInterface');
34
42
}
35
43
36
44
if (class_exists(GuzzleUri::class)) {
@@ -53,11 +61,18 @@ protected function buildStream($data)
53
61
if (defined('STREAM_FACTORY')) {
54
62
$factoryClass = STREAM_FACTORY;
55
63
$factory = new$factoryClass();
56
-
if (!$factoryinstanceof \Http\Message\StreamFactory) {
57
-
thrownew \RuntimeException('Constant "STREAM_FACTORY" must be a reference to a Http\Message\StreamFactory');
64
+
if ($factoryinstanceof \Http\Message\StreamFactory) {
65
+
return$factory->createStream($data);
66
+
}
67
+
if ($factoryinstanceof \Interop\Http\Factory\StreamFactoryInterface) {
68
+
if (is_string($data)) {
69
+
return$factory->createStream($data);
70
+
} else {
71
+
return$factory->createStreamFromResource($data);
72
+
}
58
73
}
59
74
60
-
return$factory->createStream($data);
75
+
thrownew \RuntimeException('Constant "STREAM_FACTORY" must be a reference to a Http\Message\StreamFactory or \Interop\Http\Factory\StreamFactoryInterface');
61
76
}
62
77
63
78
if (class_exists(GuzzleStream::class)) {
@@ -80,7 +95,9 @@ protected function buildUploadableFile($data)
80
95
thrownew \RuntimeException('Constant "UPLOADED_FILE_FACTORY" must be a reference to a Interop\Http\Factory\UploadedFileFactoryInterface');
0 commit comments