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
To dispatch the http request, Embed has the interface `Embed\Http\DispatcherInterface`. By default the curl library is used but you can create your own dispatcher to use any other library like [guzzle](https://github.com/guzzle/guzzle):
164
+
To dispatch the http request, Embed includes the interface `Embed\Http\DispatcherInterface`. By default the curl library is used but you can create your own dispatcher to use any other library like [guzzle](https://github.com/guzzle/guzzle):
165
165
166
166
```php
167
167
use Embed\Embed;
168
168
use Embed\Http\DispatcherInteface;
169
-
use Embed\Http\Uri;
169
+
use Embed\Http\Url;
170
170
use Embed\Http\Response;
171
171
use Embed\Http\ImageResponse;
172
172
173
173
class MyDispatcher implements DispatcherInterface
174
174
{
175
-
public function dispatch(Uri $uri)
175
+
public function dispatch(Url $url)
176
176
{
177
-
$result = function_to_execute_request($uri);
177
+
$result = function_to_execute_request($url);
178
178
179
-
return new Response($uri, $result['uri'], $result['status'], $result['type'], $result['content'], $result['headers']);
179
+
return new Response($url, $result['url'], $result['status'], $result['type'], $result['content'], $result['headers']);
180
180
}
181
181
182
-
public function dispatchImages(array $uris)
182
+
public function dispatchImages(array $urls)
183
183
{
184
184
$responses = [];
185
185
186
-
foreach ($uris as $uri) {
187
-
$result = function_to_get_image_size($uri);
186
+
foreach ($urls as $url) {
187
+
$result = function_to_get_image_size($url);
188
188
189
189
if ($result) {
190
-
$responses[] = new ImageResponse($uri, $result['uri'], $result['status'], $result['type'], $result['size'], $result['headers']);
190
+
$responses[] = new ImageResponse($url, $result['url'], $result['status'], $result['type'], $result['size'], $result['headers']);
0 commit comments