コンテナ使っていないコンストラクタが残ってた fix #110

This commit is contained in:
hina 2019-02-23 16:56:13 +09:00
parent 32b0b76032
commit a14b49b7d2
No known key found for this signature in database
GPG Key ID: 6136D5E22A0EE24B

View File

@ -2,6 +2,7 @@
namespace App\MetadataResolver;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\ServerException;
@ -67,7 +68,7 @@ class MetadataResolver implements Resolver
// Acceptヘッダには */* を足さないことにする。
$acceptTypes = array_diff(array_keys($this->mimeTypes), ['*/*']);
$client = new \GuzzleHttp\Client();
$client = app(Client::class);
$res = $client->request('GET', $url, [
'headers' => [
'Accept' => implode(', ', $acceptTypes)
@ -80,14 +81,14 @@ class MetadataResolver implements Resolver
if (isset($this->mimeTypes[$mimeType])) {
$class = $this->mimeTypes[$mimeType];
$parser = new $class();
$parser = app($class);
return $parser->parse($res->getBody());
}
if (isset($this->mimeTypes['*/*'])) {
$class = $this->mimeTypes['*/*'];
$parser = new $class();
$parser = app($class);
return $parser->parse($res->getBody());
}