odata/library/ODataProducer/HttpProcessUtility.php
/**
     * Reads the numeric part of a quality value substring, normalizing it to 0-1000
       rather than the standard 0.000-1.000 ranges.
     * 
     * @param string $text          Text to read qvalue from.
     * @param int    &$textIndex    Index into text where the qvalue starts.
     * @param int    &$qualityValue After the method executes, the normalized qvalue.
     *
     * @throws HttpHeaderFailure If any error occured while reading and processing
     *                           the quality factor.
     * @return nothing
     */
Reads the numeric part of a quality value substring, normalizing it to 0-1000
rather than the standard 0.000-1.000 ranges.

@param string $text          Text to read qvalue from.
@param int    &$textIndex    Index into text where the qvalue starts.
@param int    &$qualityValue After the method executes, the normalized qvalue.

@throws HttpHeaderFailure If any error occured while reading and processing
the quality factor.
@return nothing
Reads the numeric part of a quality value substring normalizing it to 0 - 1000 rather than the standard 0 . 000 - 1 . 000 ranges . @param string $text Text to read qvalue from . @param int &$textIndex Index into text where the qvalue starts . @param int &$qualityValue After the method executes the normalized qvalue . @throws HttpHeaderFailure If any error occured while reading and processing the quality factor . @return nothing
public static function readQualityValue($text, &$textIndex, &$qualityValue)
    {
        $digit = $text[$textIndex++];
        if ($digit == '0') {
            $qualityValue = 0;
        } else if ($digit == '1') {
            $qualityValue = 1;
        } else {
            throw new HttpHeaderFailure(
                Messages::httpProcessUtilityMalformedHeaderValue(), 
                400
            );
        }
        $textLen = strlen($text);
        if ($textIndex < $textLen && $text[$textIndex] == '.') {
            $textIndex++;
            $adjustFactor = 1000;
            while ($adjustFactor > 1 && $textIndex < $textLen) {
                $c = $text[$textIndex];
                $charValue = self::digitToInt32($c);
                if ($charValue >= 0) {
                    $textIndex++;
                    $adjustFactor /= 10;
                    $qualityValue *= 10;
                    $qualityValue += $charValue;
                } else {
                    break;
                }
            }
            $qualityValue = $qualityValue *= $adjustFactor;
            if ($qualityValue > 1000) {
                throw new HttpHeaderFailure(
                    Messages::httpProcessUtilityMalformedHeaderValue(), 
                    400
                );
            }
        } else {
            $qualityValue *= 1000;
        }
    }
public static function readQualityValue ( $ text , & $ textIndex , & $ qualityValue ) { $ digit = $ text [ $ textIndex ++ ] ; if ( $ digit == '0' ) { $ qualityValue = 0 ; } else if ( $ digit == '1' ) { $ qualityValue = 1 ; } else { throw new HttpHeaderFailure ( Messages :: httpProcessUtilityMalformedHeaderValue ( ) , 400 ) ; } $ textLen = strlen ( $ text ) ; if ( $ textIndex < $ textLen && $ text [ $ textIndex ] == '.' ) { $ textIndex ++ ; $ adjustFactor = 1000 ; while ( $ adjustFactor > 1 && $ textIndex < $ textLen ) { $ c = $ text [ $ textIndex ] ; $ charValue = self :: digitToInt32 ( $ c ) ; if ( $ charValue >= 0 ) { $ textIndex ++ ; $ adjustFactor /= 10 ; $ qualityValue *= 10 ; $ qualityValue += $ charValue ; } else { break ; } } $ qualityValue = $ qualityValue *= $ adjustFactor ; if ( $ qualityValue > 1000 ) { throw new HttpHeaderFailure ( Messages :: httpProcessUtilityMalformedHeaderValue ( ) , 400 ) ; } } else { $ qualityValue *= 1000 ; } }
Reads the numeric part of a quality value substring, normalizing it to 0-1000
rather than the standard 0.000-1.000 ranges.
Reads the numeric part of a quality value substring normalizing it to 0 - 1000 rather than the standard 0 . 000 - 1 . 000 ranges .
// Too high of a value in qvalue.