
| Current Path : /var/www/html_old/abk/web/modules/contrib/content_sync/src/Encoder/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html_old/abk/web/modules/contrib/content_sync/src/Encoder/YamlEncoder.php |
<?php
namespace Drupal\content_sync\Encoder;
use Drupal\Component\Serialization\Yaml;
use Symfony\Component\Serializer\Encoder\DecoderInterface;
use Symfony\Component\Serializer\Encoder\EncoderInterface;
use Symfony\Component\Serializer\Encoder\scalar;
/**
* Class YamlEncoder.
*
* @package Drupal\yaml_serialization
*/
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;
}
}