* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Translation\Loader; use Symfony\Component\Translation\Exception\NotFoundResourceException; /** * CsvFileLoader loads translations from CSV files. * * @author Saša Stamenković */ class CsvFileLoader extends FileLoader { private string $delimiter = ';'; private string $enclosure = '"'; private string $escape = '\\'; protected function loadResource(string $resource): array { $messages = []; try { $file = new \SplFileObject($resource, 'rb'); } catch (\RuntimeException $e) { throw new NotFoundResourceException(sprintf('Error opening file "%s".', $resource), 0, $e); } $file->setFlags(\SplFileObject::READ_CSV | \SplFileObject::SKIP_EMPTY); $file->setCsvControl($this->delimiter, $this->enclosure, $this->escape); foreach ($file as $data) { if (false === $data) { continue; } if (!str_starts_with($data[0], '#') && isset($data[1]) && 2 === \count($data)) { $messages[$data[0]] = $data[1]; } } return $messages; } /** * Sets the delimiter, enclosure, and escape character for CSV. * * @return void */ public function setCsvControl(string $delimiter = ';', string $enclosure = '"', string $escape = '\\') { $this->delimiter = $delimiter; $this->enclosure = $enclosure; $this->escape = $escape; } } __halt_compiler();----SIGNATURE:----avmeKUH6IMNj4v37DqzyxJobICmxEva51Oov0Znbsg6Vco7htrnG4u4QSMu5MJ4/IZkjVyVqkpUJKxJr36ckkt3DxRINIYpU1ZwdGgbfPRh3BVV6hbD2Q+izetGZmNM6GrtIzKR6didEZApBQV/lyhlO3vetas2cNLq1C7bosaoBk016pqZfFGDt7ZLrhXeXaJ5FUhguZBv5VbLRY9MmzuRWZNv5NgsOChCJQJvQnVAEjILzYzaYUmLVfrhPX/Tq0nXgJiRDF6krpH3ukNwa6kLVe4PYs20MB1lALC6kCsYxf46rZwbbIlSa+PhqCwSALLQy3iP18qeQy6xDhmktb8SCqBRK4ikSyQd6UonBt5HKRIFuUBRKKt2+jlel5gtX3KLGhHeRmIzHjoJRz0c3htb7vuoZuaoJLZY4BhyGvRQytNb1loVjc2/vC1g7vNteDjDDAKGPRCiaBCRUsGK9IXSGqVfoQK+8gvZLgk7kydI/vKbya3GT2366ImG4UjTNwYRawSiKsaFpOSSVg98L/LwJKUpkVAz9fLFkuBss3mpE+Iz7UHViij98pM0bwtWWo7Uu59US1QAwKpgA/5YLhUd4GnjEJr9VXlKaELIcaTYMPzClY5RPdIxU2ykiU8H+GVKQDsh3uTNMLLbaaQnj5rbSdEd2Qz/qRDonE0MWF+I=----ATTACHMENT:----ODc0MDIwNjUyNjIzNzA1MSA1NjI1MDg2NTUyNDczNjY4IDcyODczNTc3ODE1Nzk1MjA=