Commit 0e2d158c authored by Matthew Grasmick's avatar Matthew Grasmick
Browse files

Revert "Issue #3280951: Drupal 10 compatibility"

This reverts commit 66c3e1bd.
parent 66c3e1bd
Loading
Loading
Loading
Loading
+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)
+4 −4
Original line number Diff line number Diff line
@@ -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;
  }

@@ -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;
@@ -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);
+3 −3
Original line number Diff line number Diff line
@@ -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;

/**
@@ -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']);
  }