class SerializationTestEncoder

Same name in other branches
  1. 9 core/modules/serialization/tests/serialization_test/src/SerializationTestEncoder.php \Drupal\serialization_test\SerializationTestEncoder
  2. 10 core/modules/serialization/tests/serialization_test/src/SerializationTestEncoder.php \Drupal\serialization_test\SerializationTestEncoder
  3. 11.x core/modules/serialization/tests/serialization_test/src/SerializationTestEncoder.php \Drupal\serialization_test\SerializationTestEncoder

Hierarchy

  • class \Drupal\serialization_test\SerializationTestEncoder implements \Symfony\Component\Serializer\Encoder\EncoderInterface

Expanded class hierarchy of SerializationTestEncoder

1 string reference to 'SerializationTestEncoder'
serialization_test.services.yml in core/modules/serialization/tests/serialization_test/serialization_test.services.yml
core/modules/serialization/tests/serialization_test/serialization_test.services.yml
1 service uses SerializationTestEncoder
serializer.encoder.serialization_test in core/modules/serialization/tests/serialization_test/serialization_test.services.yml
Drupal\serialization_test\SerializationTestEncoder

File

core/modules/serialization/tests/serialization_test/src/SerializationTestEncoder.php, line 7

Namespace

Drupal\serialization_test
View source
class SerializationTestEncoder implements EncoderInterface {
    
    /**
     * The format that this Encoder supports.
     *
     * @var string
     */
    protected static $format = 'serialization_test';
    
    /**
     * {@inheritdoc}
     */
    public function encode($data, $format, array $context = []) {
        // @see \Drupal\serialization_test\SerializationTestNormalizer::normalize().
        return 'Normalized by ' . $data['normalized_by'] . ', Encoded by SerializationTestEncoder';
    }
    
    /**
     * {@inheritdoc}
     */
    public function supportsEncoding($format) {
        return static::$format === $format;
    }

}

Members

Title Sort descending Modifiers Object type Summary
SerializationTestEncoder::$format protected static property The format that this Encoder supports.
SerializationTestEncoder::encode public function
SerializationTestEncoder::supportsEncoding public function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.