private function getEncoder(string $format, array $context): EncoderInterface
    {
        if (isset($this->encoderByFormat[$format])
            && isset($this->encoders[$this->encoderByFormat[$format]])
        ) {
            return $this->encoders[$this->encoderByFormat[$format]];
        }

        foreach ($this->encoders as $i => $encoder) {
            if ($encoder->supportsEncoding($format, $context)) {
                $this->encoderByFormat[$format] = $i;

                return $encoder;
            }
        }

        throw new RuntimeException(sprintf('No encoder found for format "%s".', $format));
    }
private function getEncoder(string $format, array $context): EncoderInterface
    {
        if (isset($this->encoderByFormat[$format])
            && isset($this->encoders[$this->encoderByFormat[$format]])
        ) {
            return $this->encoders[$this->encoderByFormat[$format]];
        }

        foreach ($this->encoders as $i => $encoder) {
            if ($encoder->supportsEncoding($format, $context)) {
                $this->encoderByFormat[$format] = $i;

                return $encoder;
            }
        }

        throw new RuntimeException(sprintf('No encoder found for format "%s".', $format));
    }
private function getEncoder ( string $ format , array $ context ) : EncoderInterface { if ( isset ( $ this -> encoderByFormat [ $ format ] ) && isset ( $ this -> encoders [ $ this -> encoderByFormat [ $ format ] ] ) ) { return $ this -> encoders [ $ this -> encoderByFormat [ $ format ] ] ; } foreach ( $ this -> encoders as $ i => $ encoder ) { if ( $ encoder -> supportsEncoding ( $ format , $ context ) ) { $ this -> encoderByFormat [ $ format ] = $ i ; return $ encoder ; } } throw new RuntimeException ( sprintf ( 'No encoder found for format "%s".' , $ format ) ) ; }
Gets the encoder supporting the format.

@throws RuntimeException if no encoder is found
Gets the encoder supporting the format .