/**
  * @param callable $readParameter
  * @param Config|callable $config
  */
 public function __construct(callable $readParameter, $config)
 {
     if ($config === null) {
         $config = new Config();
     } elseif (is_callable($config)) {
         // Support for legacy config
         $exceptionFactory = $config;
         $config = new Config();
         $config->setExceptionMessageFactory(new LegacyExceptionMessageFactory());
         $config->setExceptionFactory(new LegacyExceptionFactory($exceptionFactory));
     }
     $this->readParameter = $readParameter;
     $this->config = $config;
 }