AcMailer\Controller\ConfigMigrationController::createWriter PHP Method

createWriter() protected method

protected createWriter ( $format ) : Zend\Config\Writer\WriterInterface
$format
return Zend\Config\Writer\WriterInterface
    protected function createWriter($format)
    {
        if (!array_key_exists($format, $this->formats) && !in_array($format, $this->formats)) {
            throw new InvalidArgumentException(sprintf('Provided format "%s" is not valid. Expected one of ["%s"]', $format, implode('", "', array_keys($this->formats))));
        }
        $writerClass = array_key_exists($format, $this->formats) ? $this->formats[$format] : $format;
        $writerClass = sprintf('%s\\%s', self::WRITER_NAMESPACE, $writerClass);
        return new $writerClass();
    }