returns priority for given acceptable

If returned priority is 0 the requested acceptable is not in the list. In
case no acceptables were added before every requested acceptable has a
priority of 1.0.

@param   string  $mimeType
@return  float
424859
public function priorityFor(string $mimeType): float
    {
        if (!isset($this->acceptables[$mimeType])) {
            if ($this->count() === 0) {
                return 1.0;
            } elseif (isset($this->acceptables['*/*'])) {
                return $this->acceptables['*/*'];
            }

            list($maintype) = explode('/', $mimeType);
            return $this->acceptables[$maintype . '/*'] ?? 0;
        }

        return $this->acceptables[$mimeType];
    }
1335689
public static function getMimeType($tmpName) {

    $finfo = finfo_open(FILEINFO_MIME_TYPE);
    $mimeType = finfo_file($finfo, $tmpName);

    return $mimeType;
  }
314948
public function isImage($mimeType)
    {
        $isValid = false;

        $allowedType = array('image/jpeg' , 'image/png' ,'image/gif');

        if (\in_array($mimeType, $allowedType)) {
            $isValid = true;
        }

        return $isValid;
    }
1071115
private function extractPriority($header) {
        if(preg_match('/x\-priority\:.*([0-9]{1,2})/i', $header, $priority)){
            $priority = isset($priority[1]) ? (int) $priority[1] : 0;
            switch($priority){
                case IMAP::MESSAGE_PRIORITY_HIGHEST;
                    $priority = IMAP::MESSAGE_PRIORITY_HIGHEST;
                    break;
                case IMAP::MESSAGE_PRIORITY_HIGH;
                    $priority = IMAP::MESSAGE_PRIORITY_HIGH;
                    break;
                case IMAP::MESSAGE_PRIORITY_NORMAL;
                    $priority = IMAP::MESSAGE_PRIORITY_NORMAL;
                    break;
                case IMAP::MESSAGE_PRIORITY_LOW;
                    $priority = IMAP::MESSAGE_PRIORITY_LOW;
                    break;
                case IMAP::MESSAGE_PRIORITY_LOWEST;
                    $priority = IMAP::MESSAGE_PRIORITY_LOWEST;
                    break;
                default:
                    $priority = IMAP::MESSAGE_PRIORITY_UNKNOWN;
                    break;
            }
        }

        return $priority;
    }
74879
public function get($mimeType)
    {
        if (!array_key_exists($mimeType, $this->map)) {
            throw new Exception\UndefinedProtocolException($mimeType);
        }

        return $this->map[$mimeType];
    }
573756
function qualityValue( $mimeType )
    {
        if ( isset( $this->QualityValueMapOverride[$mimeType] ) )
            return $this->QualityValueMapOverride[$mimeType]['value'];
        else if ( isset( $this->QualityValueMap[$mimeType] ) )
            return $this->QualityValueMap[$mimeType]['value'];
        return false;
    }
998597
public function getPartByMimeType($mimeType, $index = 0)
    {
        $partFilter = $this->partFilterFactory->newFilterFromContentType($mimeType);
        return $this->getPart($index, $partFilter);
    }
1371812
public function getMemPercentApplication()
    {
        if ($this->_memApplication !== null) {
            if (($this->_memApplication > 0) && ($this->_memTotal > 0)) {
                return round($this->_memApplication / $this->_memTotal * 100);
            } else {
                return 0;
            }
        } else {
            return null;
        }
    }
598767
protected function _getFilteredUniqueDependencies($mimeType)
    {
        $ret = parent::_getFilteredUniqueDependencies($mimeType);

        $loadedDeps = $this->_loadedPackage->_getFilteredUniqueDependencies($mimeType);

        foreach ($ret as $k=>$i) {
            if (in_array($i, $loadedDeps, true)) {
                unset($ret[$k]);
            }
        }

        $ret = array_values($ret);

        return $ret;
    }
687082
protected function sortFilters()
    {
        usort($this->filters, function (FilterInterface $a, FilterInterface $b) {
            $a = $a->getPriority();
            $b = $b->getPriority();

            if ($a == $b) {
                return 0;
            }

            return $a < $b ? -1 : 1;
        });

        $this->sorted = true;
    }
337321
public function priority($priority = null) {
		if ($priority === null) {
			return $this->_priority;
		}
		$this->_priority = $priority;
		return $this;
	}
636340
protected static function _findMimeType($mimeType) {
        if ($mimeType instanceof File) {
            $mimeType = $mimeType->type();

        } else if (strpos($mimeType, '/') === false) {
            $mimeType = self::getTypeFromExt($mimeType);
        }

        return $mimeType;
    }
76866
public function getConvertedType($mimeType)
    {
        $type = $mimeType;

        if (1 !== preg_match('#^application\/x\.[^/]+\+json$#', $mimeType) && 1 === preg_match('#^[^/]+\/[^/]+$#', $mimeType)) {
            $type = 'content';
        }

        return $type;
    }
83670
public function getMiddlewarePriorityForMiddleware( $middleware ) {
		if ( is_array( $middleware ) ) {
			$middleware = $middleware[0];
		}

		$increasing_priority = array_reverse( $this->middleware_priority );
		$priority = array_search( $middleware, $increasing_priority );
		return $priority !== false ? (int) $priority : -1;
	}
883740
private function sortByPriority($a, $b)
    {
        $a = $a['_priority'];
        $b = $b['_priority'];

        if ($a == $b) {
            return 0;
        }

        return ($a < $b) ? -1 : 1;
    }
853883
protected function getValidPriority($desiredPriority)
    {
        // make sure the priority is an integer so we don't screw up the math
        // also multiply everything by 10000 because the priority must be an integer
        // as it will be used as the $filters[$selector] array key
        $desiredPriority = (int) $desiredPriority * 10000;
        if (! in_array($desiredPriority, $this->allocatedPriorities)) {
            return $desiredPriority;
        }
        // the increment will be used to determine when we find an available spot
        // obviously if you have 10000 filters with priority 0,
        // the 10000th will get to priority one but that's a chance we are willing to take
        $increment = 1;
        while (in_array($desiredPriority, $this->allocatedPriorities)) {
            $desiredPriority += $increment;
        }
        return $desiredPriority;
    }
20491
public static function for_mimetypes($mimetypes)
    {
        foreach ($mimetypes as $mimetype) {
            if ($formatter = self::for_mimetype($mimetype)) {
                return $formatter;
            }
        }

        return false;
    }