Loading csv_serialization.info.yml +3 −2 Original line number Diff line number Diff line name: 'Serialization (CSV)' type: module description: 'Provides CSV as a serialization format.' core_version_requirement: ^9.3 || ^10 core: 8.x core_version_requirement: ^8 || ^9 package: Web services dependencies: - drupal:serialization - drupal:serialization (>=8.0.4) src/Encoder/CsvEncoder.php +4 −4 Original line number Diff line number Diff line Loading @@ -106,14 +106,14 @@ class CsvEncoder implements EncoderInterface, DecoderInterface { /** * {@inheritdoc} */ public function supportsEncoding(string $format):bool { public function supportsEncoding($format) { return $format == static::$format; } /** * {@inheritdoc} */ public function supportsDecoding(string $format):bool { public function supportsDecoding($format) { return $format == static::$format; } Loading @@ -122,7 +122,7 @@ class CsvEncoder implements EncoderInterface, DecoderInterface { * * Uses HTML-safe strings, with several characters escaped. */ public function encode($data, string $format, array $context = []):string { public function encode($data, $format, array $context = []) { switch (gettype($data)) { case "array": break; Loading Loading @@ -290,7 +290,7 @@ class CsvEncoder implements EncoderInterface, DecoderInterface { * @throws \League\Csv\Exception * @throws \League\Csv\Exception */ public function decode($data, string $format, array $context = []) { public function decode($data, $format, array $context = []) { $csv = Reader::createFromString($data); $csv->setDelimiter($this->delimiter); $csv->setEnclosure($this->enclosure); Loading src/EventSubscriber/CsvSubscriber.php +3 −3 Original line number Diff line number Diff line Loading @@ -2,8 +2,8 @@ namespace Drupal\csv_serialization\EventSubscriber; use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** Loading @@ -14,10 +14,10 @@ class CsvSubscriber implements EventSubscriberInterface { /** * Register content type formats on the request object. * * @param \Symfony\Component\HttpKernel\Event\RequestEvent $event * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event * The Event to process. */ public function onKernelRequest(RequestEvent $event) { public function onKernelRequest(GetResponseEvent $event) { $event->getRequest()->setFormat('csv', ['text/csv']); } Loading Loading
csv_serialization.info.yml +3 −2 Original line number Diff line number Diff line name: 'Serialization (CSV)' type: module description: 'Provides CSV as a serialization format.' core_version_requirement: ^9.3 || ^10 core: 8.x core_version_requirement: ^8 || ^9 package: Web services dependencies: - drupal:serialization - drupal:serialization (>=8.0.4)
src/Encoder/CsvEncoder.php +4 −4 Original line number Diff line number Diff line Loading @@ -106,14 +106,14 @@ class CsvEncoder implements EncoderInterface, DecoderInterface { /** * {@inheritdoc} */ public function supportsEncoding(string $format):bool { public function supportsEncoding($format) { return $format == static::$format; } /** * {@inheritdoc} */ public function supportsDecoding(string $format):bool { public function supportsDecoding($format) { return $format == static::$format; } Loading @@ -122,7 +122,7 @@ class CsvEncoder implements EncoderInterface, DecoderInterface { * * Uses HTML-safe strings, with several characters escaped. */ public function encode($data, string $format, array $context = []):string { public function encode($data, $format, array $context = []) { switch (gettype($data)) { case "array": break; Loading Loading @@ -290,7 +290,7 @@ class CsvEncoder implements EncoderInterface, DecoderInterface { * @throws \League\Csv\Exception * @throws \League\Csv\Exception */ public function decode($data, string $format, array $context = []) { public function decode($data, $format, array $context = []) { $csv = Reader::createFromString($data); $csv->setDelimiter($this->delimiter); $csv->setEnclosure($this->enclosure); Loading
src/EventSubscriber/CsvSubscriber.php +3 −3 Original line number Diff line number Diff line Loading @@ -2,8 +2,8 @@ namespace Drupal\csv_serialization\EventSubscriber; use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** Loading @@ -14,10 +14,10 @@ class CsvSubscriber implements EventSubscriberInterface { /** * Register content type formats on the request object. * * @param \Symfony\Component\HttpKernel\Event\RequestEvent $event * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event * The Event to process. */ public function onKernelRequest(RequestEvent $event) { public function onKernelRequest(GetResponseEvent $event) { $event->getRequest()->setFormat('csv', ['text/csv']); } Loading