plugin/exo/Serializer/Item/Type/GridQuestionSerializer.php
public function serialize(GridQuestion $gridQuestion, array $options = [])
    {
        $serialized = [
            'penalty' => $gridQuestion->getPenalty(),
            'rows' => $gridQuestion->getRows(),
            'cols' => $gridQuestion->getColumns(),
            'sumMode' => $gridQuestion->getSumMode(),
            'border' => $gridQuestion->getGridStyle(),
            'cells' => $this->serializeCells($gridQuestion, $options),
        ];

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

        return $serialized;
    }
public function serialize(GridQuestion $gridQuestion, array $options = [])
    {
        $serialized = [
            'penalty' => $gridQuestion->getPenalty(),
            'rows' => $gridQuestion->getRows(),
            'cols' => $gridQuestion->getColumns(),
            'sumMode' => $gridQuestion->getSumMode(),
            'border' => $gridQuestion->getGridStyle(),
            'cells' => $this->serializeCells($gridQuestion, $options),
        ];

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

        return $serialized;
    }
public function serialize ( GridQuestion $ gridQuestion , array $ options = [ ] ) { $ serialized = [ 'penalty' => $ gridQuestion -> getPenalty ( ) , 'rows' => $ gridQuestion -> getRows ( ) , 'cols' => $ gridQuestion -> getColumns ( ) , 'sumMode' => $ gridQuestion -> getSumMode ( ) , 'border' => $ gridQuestion -> getGridStyle ( ) , 'cells' => $ this -> serializeCells ( $ gridQuestion , $ options ) , ] ; if ( in_array ( Transfer :: INCLUDE_SOLUTIONS , $ options ) ) { $ serialized [ 'solutions' ] = $ this -> serializeSolutions ( $ gridQuestion , $ options ) ; } return $ serialized ; }
Converts a Grid question into a JSON-encodable structure.

@param GridQuestion $gridQuestion
@param array        $options

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