private function autoDetectAdapter(Import $import)
	{
		// make sure we dont already have an adapter
		if ($this->adapter)
		{
			return;
		}

		// get path to data file
		$dataPath = $import->getDataPath();

		// get the mime type of file
		$file = finfo_open(FILEINFO_MIME_TYPE);
		$mime = finfo_file($file, $dataPath);
		if ($mime == 'text/plain')
		{
			$mime = pathinfo($dataPath, PATHINFO_EXTENSION);
		}

		// anonymous function to see if we can use any
		$respondsTo = function($class) use ($mime)
		{
			return $class::accepts($mime);
		};

		// set the adapter if we found one
		$responded = array_filter($this->adapters, $respondsTo);
		if ($adapter = array_shift($responded))
		{
			$this->setAdapter(new $adapter());
		}

		// do we still not have adapter
		if (!$this->adapter)
		{
			throw new \Exception(\Lang::txt('Content Import: No adapter found to count import data.'));
		}
	}
private function autoDetectAdapter(Import $import)
	{
		// make sure we dont already have an adapter
		if ($this->adapter)
		{
			return;
		}

		// get path to data file
		$dataPath = $import->getDataPath();

		// get the mime type of file
		$file = finfo_open(FILEINFO_MIME_TYPE);
		$mime = finfo_file($file, $dataPath);
		if ($mime == 'text/plain')
		{
			$mime = pathinfo($dataPath, PATHINFO_EXTENSION);
		}

		// anonymous function to see if we can use any
		$respondsTo = function($class) use ($mime)
		{
			return $class::accepts($mime);
		};

		// set the adapter if we found one
		$responded = array_filter($this->adapters, $respondsTo);
		if ($adapter = array_shift($responded))
		{
			$this->setAdapter(new $adapter());
		}

		// do we still not have adapter
		if (!$this->adapter)
		{
			throw new \Exception(\Lang::txt('Content Import: No adapter found to count import data.'));
		}
	}
private function autoDetectAdapter ( Import $ import ) { // make sure we dont already have an adapter if ( $ this -> adapter ) { return ; } // get path to data file $ dataPath = $ import -> getDataPath ( ) ; // get the mime type of file $ file = finfo_open ( FILEINFO_MIME_TYPE ) ; $ mime = finfo_file ( $ file , $ dataPath ) ; if ( $ mime == 'text/plain' ) { $ mime = pathinfo ( $ dataPath , PATHINFO_EXTENSION ) ; } // anonymous function to see if we can use any $ respondsTo = function ( $ class ) use ( $ mime ) { return $ class :: accepts ( $ mime ) ; } ; // set the adapter if we found one $ responded = array_filter ( $ this -> adapters , $ respondsTo ) ; if ( $ adapter = array_shift ( $ responded ) ) { $ this -> setAdapter ( new $ adapter ( ) ) ; } // do we still not have adapter if ( ! $ this -> adapter ) { throw new \ Exception ( \ Lang :: txt ( 'Content Import: No adapter found to count import data.' ) ) ; } }
Method auto detect adapter based on mime type

@param   object  $import
@return  void
Method auto detect adapter based on mime type