|
5 | 5 | use GuzzleHttp\Psr7\Stream as GuzzleStream;
|
6 | 6 | use GuzzleHttp\Psr7\UploadedFile as GuzzleUploadedFile;
|
7 | 7 | use GuzzleHttp\Psr7\Uri as GuzzleUri;
|
| 8 | +use HttpSoft\Message\StreamFactory as HttpSoftStreamFactory; |
| 9 | +use HttpSoft\Message\UploadedFile as HttpSoftUploadedFile; |
| 10 | +use HttpSoft\Message\Uri as HttpSoftUri; |
8 | 11 | use Laminas\Diactoros\StreamFactory as LaminasStreamFactory;
|
9 | 12 | use Laminas\Diactoros\Uri as LaminasUri;
|
10 | 13 | use Laminas\Diactoros\UploadedFile as LaminasUploadedFile;
|
@@ -47,6 +50,10 @@ protected function buildUri($uri)
|
47 | 50 | throw new \RuntimeException('Constant "URI_FACTORY" must be a reference to a Http\Message\UriFactory or \Psr\Http\Message\UriFactoryInterface');
|
48 | 51 | }
|
49 | 52 |
|
| 53 | + if (class_exists(HttpSoftUri::class)) { |
| 54 | + return new HttpSoftUri($uri); |
| 55 | + } |
| 56 | + |
50 | 57 | if (class_exists(GuzzleUri::class)) {
|
51 | 58 | return new GuzzleUri($uri);
|
52 | 59 | }
|
@@ -98,6 +105,9 @@ protected function buildStream($data)
|
98 | 105 | }
|
99 | 106 |
|
100 | 107 | $factory = null;
|
| 108 | + if (class_exists(HttpSoftStreamFactory::class)) { |
| 109 | + $factory = new HttpSoftStreamFactory(); |
| 110 | + } |
101 | 111 | if (class_exists(LaminasStreamFactory::class)) {
|
102 | 112 | $factory = new LaminasStreamFactory();
|
103 | 113 | }
|
@@ -136,6 +146,10 @@ protected function buildUploadableFile($data)
|
136 | 146 | return $factory->createUploadedFile($stream);
|
137 | 147 | }
|
138 | 148 |
|
| 149 | + if (class_exists(HttpSoftUploadedFile::class)) { |
| 150 | + return new HttpSoftUploadedFile($data, strlen($data), 0); |
| 151 | + } |
| 152 | + |
139 | 153 | if (class_exists(GuzzleUploadedFile::class)) {
|
140 | 154 | return new GuzzleUploadedFile($data, strlen($data), 0);
|
141 | 155 | }
|
|
0 commit comments