protected function getFormatter(array $config)
    {
        if (isset($config['formatter'])) {
            if (!$config['formatter'] instanceof FormatterInterface) {
                throw new \DomainException(
                    'formatter must implement ' . __NAMESPACE__ . '\FormatterInterface',
                    self::ERR_FORMATTER_INVALID
                );
            }
            return $config['formatter'];
        }
        return new DefaultFormatter;
    }