/**
* @param array<EncoderInterface> $encoders
*/
public function __construct( private readonly array
$encoders =
[] ) { } final public function encode(mixed
$data, string
$format, array
$context =
[]): string
{ return $this->
getEncoder($format,
$context)->
encode($data,
$format,
$context);
} public function supportsEncoding(string
$format, array
$context =
[]): bool
{ try { $this->
getEncoder($format,
$context);
} catch (RuntimeException
) { return false;
} return true;
}