for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace ElevenLabs\Api\Decoder\Adapter;
use ElevenLabs\Api\Decoder\DecoderInterface;
use Symfony\Component\Serializer\Encoder\DecoderInterface as SymfonyDecoderInterface;
class SymfonyDecoderAdapter implements DecoderInterface
{
/**
* @var SymfonyDecoderInterface
*/
private $decoder;
public function __construct(SymfonyDecoderInterface $decoder)
$this->decoder = $decoder;
}
public function decode($data, $format)
$context = [];
if ($format === 'json') {
// the JSON schema validator need an object hierarchy
$context['json_decode_associative'] = false;
$decoded = $this->decoder->decode($data, $format, $context);
if ($format === 'xml') {
$decoded = json_decode(json_encode($decoded));
return $decoded;