fix: phpcs-fixer

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-02-05 21:32:04 +01:00
parent ba874480ee
commit c55cd62ec7
65 changed files with 346 additions and 355 deletions

View File

@@ -4,20 +4,21 @@ namespace App\Domain\Scraping\Infrastructure\Service;
use Symfony\Contracts\HttpClient\HttpClientInterface;
class ImageDownloader
class ImageDownloader
{
public function __construct(
private readonly HttpClientInterface $httpClient
) {}
) {
}
public function download(string $url, string $destination): void
{
$response = $this->httpClient->request('GET', $url);
if (!str_starts_with($response->getHeaders()['content-type'][0], 'image/')) {
throw new \RuntimeException('Invalid content type');
}
file_put_contents($destination, $response->getContent());
}
}
}