Пример #1
0
 /**
  * Method to detect which file type class to use for a specific $_file
  *
  * @return MediaModelFileTypeInterface
  */
 protected function loadFileType()
 {
     if ($this->fileType instanceof MediaModelFileTypeInterface) {
         return $this->fileType;
     }
     if (!isset($this->fileProperties['path'])) {
         return false;
     }
     if (!$this->fileAdapter instanceof MediaModelFileAdapterInterface) {
         $this->loadFileAdapter();
     }
     $typeFactory = new MediaModelFileType();
     $this->fileType = $typeFactory->getFileType($this->fileProperties['path'], $this->fileAdapter);
     return $this->fileType;
 }
 /**
  * Method to detect which file type class to use for a specific $_file
  *
  * @return  MediaModelFileAdapterInterfaceAdapter
  * @since 3.7.0
  */
 protected function loadFileType()
 {
     if ($this->fileType instanceof MediaModelFileTypeInterface) {
         return $this->fileType;
     }
     if (!isset($this->fileProperties['path'])) {
         return false;
     }
     if (!$this->fileAdapter instanceof MediaModelFileAdapterInterfaceAdapter) {
         $this->loadFileAdapter();
     }
     $typeFactory = new MediaModelFileType();
     $this->fileType = $typeFactory->getFileType($this->fileProperties['path'], $this->fileAdapter);
     if (!$this->fileType instanceof MediaModelFileTypeInterface) {
         throw new RuntimeException(JText::_('JERROR_UNDEFINED') . ': ' . $this->fileProperties['path']);
     }
     $this->fileProperties['file_type'] = $this->fileType->getName();
     return $this->fileType;
 }