protected function fetchChoice($choices, $index, $count)
    {
        $choice = $choices[$index];

        // Set from number, if not set (notation ":X").
        if (!$choice->range->from) {
            if ($index > 0) {
                $choice->range->from = ($choices[($index - 1)]->range->to + 1);
            } else {
                $choice->range->from = (-PHP_INT_MAX);
            }
        }
        // Set to number, if not set (notation "X" or "X:").
        if (!$choice->range->to) {
            if ($index < ($count - 1)) {
                $choice->range->to = ($choices[($index + 1)]->range->from - 1);
            } else {
                $choice->range->to = PHP_INT_MAX;
            }
        }

        return $choice;
    }
protected function fetchChoice($choices, $index, $count)
    {
        $choice = $choices[$index];

        // Set from number, if not set (notation ":X").
        if (!$choice->range->from) {
            if ($index > 0) {
                $choice->range->from = ($choices[($index - 1)]->range->to + 1);
            } else {
                $choice->range->from = (-PHP_INT_MAX);
            }
        }
        // Set to number, if not set (notation "X" or "X:").
        if (!$choice->range->to) {
            if ($index < ($count - 1)) {
                $choice->range->to = ($choices[($index + 1)]->range->from - 1);
            } else {
                $choice->range->to = PHP_INT_MAX;
            }
        }

        return $choice;
    }
protected function fetchChoice ( $ choices , $ index , $ count ) { $ choice = $ choices [ $ index ] ; // Set from number, if not set (notation ":X"). if ( ! $ choice -> range -> from ) { if ( $ index > 0 ) { $ choice -> range -> from = ( $ choices [ ( $ index - 1 ) ] -> range -> to + 1 ) ; } else { $ choice -> range -> from = ( - PHP_INT_MAX ) ; } } // Set to number, if not set (notation "X" or "X:"). if ( ! $ choice -> range -> to ) { if ( $ index < ( $ count - 1 ) ) { $ choice -> range -> to = ( $ choices [ ( $ index + 1 ) ] -> range -> from - 1 ) ; } else { $ choice -> range -> to = PHP_INT_MAX ; } } return $ choice ; }
Extract a single choice from the array of choices and sanitize its values.

@param array $choices The choice array.

@param int   $index   The index to extract.

@param int   $count   Amount of all choices in the array (passed to prevent calling count() multiple times).

@return object
Extract a single choice from the array of choices and sanitize its values .