| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- declare(strict_types=1);
- namespace App\Service\File\Storage;
- use App\Entity\Access\Access;
- use App\Entity\Core\File;
- use App\Service\ApiLegacy\ApiLegacyRequestService;
- use App\Service\Utils\UrlBuilder;
- use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
- use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
- use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
- use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
- use Symfony\Contracts\HttpClient\HttpClientInterface;
- /**
- * Read and write files into the Opentalent API v1 storage
- */
- class ApiLegacyStorage implements FileStorageInterface
- {
- public function __construct(private ApiLegacyRequestService $apiLegacyRequestService)
- {}
- public function exists(File $file, string $content, Access $author): File {
- throw new \RuntimeException('not implemented error');
- }
- /**
- * Reads the given file and returns its content as a string
- *
- * @param File $file
- * @return string
- */
- public function read(File $file): string
- {
- $url = '_internal/secure/files/' . $file->getId();
- return $this->apiLegacyRequestService->getContent($url);
- }
- public function write(File $file, string $content, Access $author): File {
- throw new \RuntimeException('not implemented error');
- }
- }
|