/**
  * @param string $filename
  *
  * @throws UnknownFileTypeException
  *
  * @return string
  */
 private function getReaderClass($filename)
 {
     $readerClass = null;
     foreach ($this->config as $extension => $className) {
         if ($this->endsWith($filename, $extension)) {
             $readerClass = $className;
             break;
         }
     }
     if ($readerClass === null) {
         throw UnknownFileTypeException::fromFileExtension($filename, array_keys($this->config));
     }
     return $readerClass;
 }
 public function testItCanBeCreatedFromFileExtension()
 {
     $exception = UnknownFileTypeException::fromFileExtension('.yml', ['.json', '.php']);
     assertSame('No reader configured for ".yml" files; readers are available for [".json", ".php"].', $exception->getMessage());
 }