public function &getOrderedOptions()
    {
        if ($this->values === null) {
            $ordered_options = $this->options;
        } else {
            // copy options array so we don't modify the original
            $options = $this->options;
            $ordered_options = array();
            foreach ($this->values as $value) {
                foreach ($options as $key => $option) {
                    if ($option->value === $value) {
                        $ordered_options[] = $option;
                        unset($options[$key]);
                        break;
                    }
                }
            }

            // add leftover options
            foreach ($options as $option) {
                $ordered_options[] = $option;
            }
        }

        return $ordered_options;
    }