public function compare(MatchedPreferenceInterface $lValue, MatchedPreferenceInterface $rValue)
    {
        // Compare by quality factors - highest quality factor has precedence.
        $result = $this->compareQualityFactorPair($lValue, $rValue);

        // Quality factors are equal attempt to sort by match precedence
        if (0 === $result) {
            $result = $this->comparePrecedence($lValue, $rValue);
        }

        // Quality factors & precedences match, simply sort alphabetically as this ensures that the sort is stable
        if (0 === $result) {
            $result = $this->compareVariant($lValue, $rValue);
        }

        return $result;
    }