| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- declare(strict_types=1);
- namespace App\Service\Export\Encoder;
- use Phpdocx\Create\CreateDocx;
- use App\Enum\Export\ExportFormatEnum;
- /**
- * Encode HTML to docx format
- */
- class DocXEncoder implements EncoderInterface
- {
- public function support(string $format): bool
- {
- return $format === ExportFormatEnum::DOCX()->getValue();
- }
- // TODO: resolve Phpstan errors
- /**
- * Encode the given HTML content into docX, and
- * return the encoded content
- *
- * @param string $html
- * @param array<mixed> $options
- * @return string
- */
- public function encode(string $html, array $options = []): string
- {
- // $docx = new CreateDocx();
- // $docx->embedHTML($html);
- // $tempFile = tempnam(sys_get_temp_dir(), 'docx');
- // $docx->createDocx($tempFile);
- // $content = file_get_contents($tempFile);
- // unlink($tempFile);
- // return $content;
- return "";
- }
- }
|