function SerializationTestEncoder::encode

Same name in other branches
  1. 9 core/modules/serialization/tests/serialization_test/src/SerializationTestEncoder.php \Drupal\serialization_test\SerializationTestEncoder::encode()
  2. 8.9.x core/modules/serialization/tests/serialization_test/src/SerializationTestEncoder.php \Drupal\serialization_test\SerializationTestEncoder::encode()
  3. 10 core/modules/serialization/tests/serialization_test/src/SerializationTestEncoder.php \Drupal\serialization_test\SerializationTestEncoder::encode()

File

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

Class

SerializationTestEncoder

Namespace

Drupal\serialization_test

Code

public function encode($data, $format, array $context = []) : string {
    // @see \Drupal\serialization_test\SerializationTestNormalizer::normalize().
    return 'Normalized by ' . $data['normalized_by'] . ', Encoded by SerializationTestEncoder';
}

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