/**
  * Return a file type object
  *
  * @param   string                                $filePath
  * @param   MediaModelFileAdapterInterfaceAdapter $fileAdapter
  *
  * @return  MediaModelFileTypeInterface
  *
  * @since   3.6
  */
 public function getFileType($filePath, $fileAdapter)
 {
     /** @var $fileAdapter MediaModelFileAdapterInterfaceAdapter */
     // Loop through the available file types and match this file accordingly
     foreach ($this->getAvailableFileTypes() as $availableFileType) {
         /** @var $availableFileType MediaModelFileTypeInterface */
         // Detect the MIME-type
         $mimeType = $fileAdapter->setFilePath($filePath)->getMimeType();
         if (in_array($mimeType, $availableFileType->getMimeTypes())) {
             return $availableFileType;
         }
         if (in_array(JFile::getExt($filePath), $availableFileType->getExtensions())) {
             return $availableFileType;
         }
     }
     return $this->availableFileTypes['default'];
 }
 /**
  * Merge file type specific properties with the generic file properties
  *
  * @return  void
  * @since 3.7.0
  */
 protected function setPropertiesByFileAdapter()
 {
     if (!$this->fileAdapter) {
         return;
     }
     $mimeType = $this->fileAdapter->getMimeType($this->fileProperties['path']);
     if (empty($mimeType)) {
         return;
     }
     $this->fileProperties['mime_type'] = $mimeType;
 }