You are here

class ContentHubCdfEncoder in Acquia Content Hub 8

Encodes Content Hub CDF data in JSON.

Simply respond to the acquia_contenthub_cdf format requests using the JSON encoder.

Hierarchy

  • class \Drupal\acquia_contenthub\Encoder\ContentHubCdfEncoder extends \Symfony\Component\Serializer\Encoder\JsonEncoder

Expanded class hierarchy of ContentHubCdfEncoder

1 file declares its use of ContentHubCdfEncoder
ContentHubCdfEncoderTest.php in tests/src/Unit/Encoder/ContentHubCdfEncoderTest.php
1 string reference to 'ContentHubCdfEncoder'
acquia_contenthub.services.yml in ./acquia_contenthub.services.yml
acquia_contenthub.services.yml
1 service uses ContentHubCdfEncoder
serializer.encoder.acquia_contenthub_cdf.acquia_contenthub in ./acquia_contenthub.services.yml
Drupal\acquia_contenthub\Encoder\ContentHubCdfEncoder

File

src/Encoder/ContentHubCdfEncoder.php, line 13

Namespace

Drupal\acquia_contenthub\Encoder
View source
class ContentHubCdfEncoder extends SymfonyJsonEncoder {

  /**
   * The formats that this Encoder supports.
   *
   * @var string
   */
  protected $format = 'acquia_contenthub_cdf';

  /**
   * {@inheritdoc}
   */
  public function supportsEncoding($format) {
    return $format == $this->format;
  }

  /**
   * {@inheritdoc}
   */
  public function supportsDecoding($format) {
    return $format == $this->format;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ContentHubCdfEncoder::$format protected property The formats that this Encoder supports.
ContentHubCdfEncoder::supportsDecoding public function Checks whether the deserializer can decode from given format.
ContentHubCdfEncoder::supportsEncoding public function Checks whether the serializer can encode to given format.