accept different letter cases in export format arguments

This commit is contained in:
Daniel Seifert 2021-07-14 13:27:58 +02:00
parent 8b354993ca
commit baf30ef196
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F

View File

@ -41,9 +41,12 @@ class RendererBridge
*/
public function getRenderer(string $format = self::FORMAT_CSV): RendererInterface
{
$rendererList = $this->getRendererList();
$format = strtolower($format);
if (in_array($format, array_keys($rendererList))) {
$rendererList = array_change_key_case($this->getRendererList(), CASE_LOWER);
$rendererListTypes = array_keys(array_change_key_case($rendererList, CASE_LOWER));
if (in_array($format, $rendererListTypes, true)) {
return $rendererList[$format];
}