protected function resolveFormat()
{
if (array_key_exists('format', $this->options)) {
$format = $this->options['format'];
} elseif (method_exists($this->config, 'getFormat')) {
$format = $this->config->getFormat();
} else {
$format = 'txt';
// default
}
if (!in_array($format, $this->formats, true)) {
throw new InvalidConfigurationException(sprintf('The format "%s" is not defined, supported are %s.', $format, implode(', ', $this->formats)));
}
$this->format = $format;
}