class YamlEncoder in Content Synchronization 8.2
Same name and namespace in other branches
- 3.0.x src/Encoder/YamlEncoder.php \Drupal\content_sync\Encoder\YamlEncoder
Class YamlEncoder.
@package Drupal\yaml_serialization
Hierarchy
- class \Drupal\content_sync\Encoder\YamlEncoder implements \Symfony\Component\Serializer\Encoder\EncoderInterface, \Symfony\Component\Serializer\Encoder\DecoderInterface
Expanded class hierarchy of YamlEncoder
1 string reference to 'YamlEncoder'
1 service uses YamlEncoder
File
- src/
Encoder/ YamlEncoder.php, line 16
Namespace
Drupal\content_sync\EncoderView source
class YamlEncoder implements EncoderInterface, DecoderInterface {
/**
* The formats that this Encoder supports.
*
* @var string
*/
protected $format = 'yaml';
protected $yaml;
/**
* Constructor.
*/
public function __construct(Yaml $yaml) {
$this->yaml = $yaml;
}
public function decode($data, $format, array $context = array()) {
return $this->yaml
->decode($data);
}
public function supportsDecoding($format) {
return $format == $this->format;
}
public function encode($data, $format, array $context = array()) {
return $this->yaml
->encode($data);
}
public function supportsEncoding($format) {
return $format == $this->format;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
YamlEncoder:: |
protected | property | The formats that this Encoder supports. | |
YamlEncoder:: |
protected | property | ||
YamlEncoder:: |
public | function | Decodes a string into PHP data. | |
YamlEncoder:: |
public | function | Encodes data into the given format. | |
YamlEncoder:: |
public | function | Checks whether the deserializer can decode from given format. | |
YamlEncoder:: |
public | function | Checks whether the serializer can encode to given format. | |
YamlEncoder:: |
public | function | Constructor. |