plugin/exo/Serializer/ExerciseSerializer.php
public function serialize(Exercise $exercise, array $options = [])
    {
        $serialized = [
            'id' => $exercise->getUuid(),
            'title' => $exercise->getResourceNode()->getName(), // TODO : remove me. it's required by the json schema
        ];

        if (!in_array(Transfer::MINIMAL, $options)) {
            if (!empty($exercise->getDescription())) {
                $serialized['description'] = $exercise->getDescription();
            }
            $serialized['parameters'] = $this->serializeParameters($exercise);
            $serialized['picking'] = $this->serializePicking($exercise);
            $serialized['steps'] = $this->serializeSteps($exercise, $options);
        }

        return $serialized;
    }
public function serialize(Exercise $exercise, array $options = [])
    {
        $serialized = [
            'id' => $exercise->getUuid(),
            'title' => $exercise->getResourceNode()->getName(), // TODO : remove me. it's required by the json schema
        ];

        if (!in_array(Transfer::MINIMAL, $options)) {
            if (!empty($exercise->getDescription())) {
                $serialized['description'] = $exercise->getDescription();
            }
            $serialized['parameters'] = $this->serializeParameters($exercise);
            $serialized['picking'] = $this->serializePicking($exercise);
            $serialized['steps'] = $this->serializeSteps($exercise, $options);
        }

        return $serialized;
    }
public function serialize ( Exercise $ exercise , array $ options = [ ] ) { $ serialized = [ 'id' => $ exercise -> getUuid ( ) , 'title' => $ exercise -> getResourceNode ( ) -> getName ( ) , // TODO : remove me. it's required by the json schema ] ; if ( ! in_array ( Transfer :: MINIMAL , $ options ) ) { if ( ! empty ( $ exercise -> getDescription ( ) ) ) { $ serialized [ 'description' ] = $ exercise -> getDescription ( ) ; } $ serialized [ 'parameters' ] = $ this -> serializeParameters ( $ exercise ) ; $ serialized [ 'picking' ] = $ this -> serializePicking ( $ exercise ) ; $ serialized [ 'steps' ] = $ this -> serializeSteps ( $ exercise , $ options ) ; } return $ serialized ; }
Converts an Exercise into a JSON-encodable structure.

@param Exercise $exercise
@param array    $options

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