plugin/exo/Serializer/Item/Type/OrderingQuestionSerializer.php
public function serialize(OrderingQuestion $question, array $options = [])
    {
        $serialized = [
            'mode' => $question->getMode(),
            'direction' => $question->getDirection(),
            'penalty' => $question->getPenalty(),
        ];

        // Serializes items
        $items = $this->serializeItems($question, $options);

        // shuffle items only in player
        if (in_array(Transfer::SHUFFLE_ANSWERS, $options)) {
            shuffle($items);
        }
        $serialized['items'] = $items;

        if (in_array(Transfer::INCLUDE_SOLUTIONS, $options)) {
            $serialized['solutions'] = $this->serializeSolutions($question);
        }

        return $serialized;
    }
public function serialize(OrderingQuestion $question, array $options = [])
    {
        $serialized = [
            'mode' => $question->getMode(),
            'direction' => $question->getDirection(),
            'penalty' => $question->getPenalty(),
        ];

        // Serializes items
        $items = $this->serializeItems($question, $options);

        // shuffle items only in player
        if (in_array(Transfer::SHUFFLE_ANSWERS, $options)) {
            shuffle($items);
        }
        $serialized['items'] = $items;

        if (in_array(Transfer::INCLUDE_SOLUTIONS, $options)) {
            $serialized['solutions'] = $this->serializeSolutions($question);
        }

        return $serialized;
    }
public function serialize ( OrderingQuestion $ question , array $ options = [ ] ) { $ serialized = [ 'mode' => $ question -> getMode ( ) , 'direction' => $ question -> getDirection ( ) , 'penalty' => $ question -> getPenalty ( ) , ] ; // Serializes items $ items = $ this -> serializeItems ( $ question , $ options ) ; // shuffle items only in player if ( in_array ( Transfer :: SHUFFLE_ANSWERS , $ options ) ) { shuffle ( $ items ) ; } $ serialized [ 'items' ] = $ items ; if ( in_array ( Transfer :: INCLUDE_SOLUTIONS , $ options ) ) { $ serialized [ 'solutions' ] = $ this -> serializeSolutions ( $ question ) ; } return $ serialized ; }
Converts an Ordering question into a JSON-encodable structure.

@param OrderingQuestion $question
@param array            $options

@return array
Converts an Ordering question into a JSON - encodable structure .