/** * This creates an instance of the appropriate reader, given the type of the file to be read * * @param string $readerType Type of the reader to instantiate * @return ReaderInterface * @throws \Box\Spout\Common\Exception\UnsupportedTypeException */ public static function create($readerType) { $reader = null; switch ($readerType) { case Type::CSV: $reader = new CSV\Reader(); break; case Type::XLSX: $reader = new XLSX\Reader(); break; default: throw new UnsupportedTypeException('No readers supporting the given type: ' . $readerType); } $reader->setGlobalFunctionsHelper(new GlobalFunctionsHelper()); return $reader; }