/** * Check whether the extractor service supports this file according to file type restrictions. * * @param File $file * @param ExtractorInterface $extractor * @return bool */ protected function isFileTypeSupportedByExtractor(File $file, ExtractorInterface $extractor) { $isSupported = true; $fileTypeRestrictions = $extractor->getFileTypeRestrictions(); if (!empty($fileTypeRestrictions) && !in_array($file->getType(), $fileTypeRestrictions)) { $isSupported = false; } return $isSupported; }
/** * Compare the priority of two Extractor classes. * Is used for sorting array of Extractor instances by priority. * We want the result to be ordered from high to low so a higher * priority comes before a lower. * * @param ExtractorInterface $extractorA * @param ExtractorInterface $extractorB * @return int -1 a > b, 0 a == b, 1 a < b */ protected function compareExtractorPriority(ExtractorInterface $extractorA, ExtractorInterface $extractorB) { return $extractorB->getPriority() - $extractorA->getPriority(); }