plugin/exo/Serializer/Item/Type/SelectionQuestionSerializer.php
public function deserialize($data, SelectionQuestion $selectionQuestion = null, array $options = [])
    {
        if (empty($selectionQuestion)) {
            $selectionQuestion = new SelectionQuestion();
        }
        $this->sipe('text', 'setText', $data, $selectionQuestion);
        $this->sipe('mode', 'setMode', $data, $selectionQuestion);
        $this->sipe('tries', 'setTries', $data, $selectionQuestion);
        $this->sipe('penalty', 'setPenalty', $data, $selectionQuestion);

        // colors must be deserialized first because they might be useful for selections
        if (isset($data['colors'])) {
            $this->deserializeColors($selectionQuestion, $data['colors']);
        }

        $options['selection_mode'] = $data['mode'];

        if (isset($data['selections']) && 'find' !== $data['mode']) {
            $this->deserializeSelections($selectionQuestion, $data['selections'], $data['solutions'], $options);
        }

        if (isset($data['solutions']) && 'find' === $data['mode']) {
            $this->deserializeSolutions($selectionQuestion, $data['solutions'], $options);
        }

        return $selectionQuestion;
    }
public function deserialize($data, SelectionQuestion $selectionQuestion = null, array $options = [])
    {
        if (empty($selectionQuestion)) {
            $selectionQuestion = new SelectionQuestion();
        }
        $this->sipe('text', 'setText', $data, $selectionQuestion);
        $this->sipe('mode', 'setMode', $data, $selectionQuestion);
        $this->sipe('tries', 'setTries', $data, $selectionQuestion);
        $this->sipe('penalty', 'setPenalty', $data, $selectionQuestion);

        // colors must be deserialized first because they might be useful for selections
        if (isset($data['colors'])) {
            $this->deserializeColors($selectionQuestion, $data['colors']);
        }

        $options['selection_mode'] = $data['mode'];

        if (isset($data['selections']) && 'find' !== $data['mode']) {
            $this->deserializeSelections($selectionQuestion, $data['selections'], $data['solutions'], $options);
        }

        if (isset($data['solutions']) && 'find' === $data['mode']) {
            $this->deserializeSolutions($selectionQuestion, $data['solutions'], $options);
        }

        return $selectionQuestion;
    }
public function deserialize ( $ data , SelectionQuestion $ selectionQuestion = null , array $ options = [ ] ) { if ( empty ( $ selectionQuestion ) ) { $ selectionQuestion = new SelectionQuestion ( ) ; } $ this -> sipe ( 'text' , 'setText' , $ data , $ selectionQuestion ) ; $ this -> sipe ( 'mode' , 'setMode' , $ data , $ selectionQuestion ) ; $ this -> sipe ( 'tries' , 'setTries' , $ data , $ selectionQuestion ) ; $ this -> sipe ( 'penalty' , 'setPenalty' , $ data , $ selectionQuestion ) ; // colors must be deserialized first because they might be useful for selections if ( isset ( $ data [ 'colors' ] ) ) { $ this -> deserializeColors ( $ selectionQuestion , $ data [ 'colors' ] ) ; } $ options [ 'selection_mode' ] = $ data [ 'mode' ] ; if ( isset ( $ data [ 'selections' ] ) && 'find' !== $ data [ 'mode' ] ) { $ this -> deserializeSelections ( $ selectionQuestion , $ data [ 'selections' ] , $ data [ 'solutions' ] , $ options ) ; } if ( isset ( $ data [ 'solutions' ] ) && 'find' === $ data [ 'mode' ] ) { $ this -> deserializeSolutions ( $ selectionQuestion , $ data [ 'solutions' ] , $ options ) ; } return $ selectionQuestion ; }
Converts raw data into a Selection question entity.

@param array             $data
@param SelectionQuestion $selectionQuestion
@param array             $options

@return SelectionQuestion
Converts raw data into a Selection question entity .