/** * Returns true if the file is of a supported media type and adds it to the array of items to * return * * @todo We could potentially check if the file is readable ($file->stat() maybe) in order to * only return valid files, but this may slow down operations * * @param File $file the file to test * * @return bool */ private function isPreviewAvailable($file) { try { $mimeType = $file->getMimetype(); if (in_array($mimeType, $this->supportedMediaTypes)) { $this->addFileToResults($file); return true; } } catch (\Exception $exception) { return false; } return false; }