Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 4 |
| SerializationTestEncoder | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 4 |
| encode | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| supportsEncoding | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| <?php | |
| /** | |
| * @file | |
| * Contains \Drupal\serialization_test\SerializationTestEncoder. | |
| */ | |
| namespace Drupal\serialization_test; | |
| use Symfony\Component\Serializer\Encoder\EncoderInterface; | |
| class SerializationTestEncoder implements EncoderInterface { | |
| /** | |
| * The format that this Encoder supports. | |
| * | |
| * @var string | |
| */ | |
| static protected $format = 'serialization_test'; | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function encode($data, $format, array $context = array()) { | |
| // @see \Drupal\serialization_test\SerializationTestNormalizer::normalize(). | |
| return 'Normalized by ' . $data['normalized_by'] . ', Encoded by SerializationTestEncoder'; | |
| } | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function supportsEncoding($format) { | |
| return static::$format === $format; | |
| } | |
| } |