/**
  * Returns an SnakFormatter for rendering snaks in the desired format
  * using the given options.
  *
  * @param string $format Use the SnakFormatter::FORMAT_XXX constants.
  * @param FormatterOptions $options
  *
  * @throws RuntimeException
  * @throws InvalidArgumentException
  * @return SnakFormatter
  */
 public function getSnakFormatter($format, FormatterOptions $options)
 {
     $options->defaultOption(SnakFormatter::OPT_ON_ERROR, SnakFormatter::ON_ERROR_WARN);
     $this->valueFormatterFactory->applyLanguageDefaults($options);
     $lang = $options->getOption(ValueFormatter::OPT_LANG);
     $noValueSnakFormatter = new MessageSnakFormatter('novalue', $this->getMessage('wikibase-snakview-snaktypeselector-novalue', $lang), $format);
     $someValueSnakFormatter = new MessageSnakFormatter('somevalue', $this->getMessage('wikibase-snakview-snaktypeselector-somevalue', $lang), $format);
     $valueFormatter = $this->valueFormatterFactory->getValueFormatter($format, $options);
     $valueSnakFormatter = new PropertyValueSnakFormatter($format, $options, $valueFormatter, $this->propertyDataTypeLookup, $this->dataTypeFactory);
     $formattersBySnakType = array('novalue' => $noValueSnakFormatter, 'somevalue' => $someValueSnakFormatter);
     $formattersByDataType = $this->createSnakFormatters($format, $options);
     // Register default formatter for the special '*' key.
     $formattersByDataType['*'] = $valueSnakFormatter;
     $snakFormatter = new DispatchingSnakFormatter($format, $this->propertyDataTypeLookup, $formattersBySnakType, $formattersByDataType);
     if ($options->getOption(SnakFormatter::OPT_ON_ERROR) === SnakFormatter::ON_ERROR_WARN) {
         $snakFormatter = new ErrorHandlingSnakFormatter($snakFormatter, $valueFormatter, $lang);
     }
     return $snakFormatter;
 }