protected function parseQuestionPresentation ($presentation, $type){

        // Text areas don't have options or scores
        if ($type == 'textarea') {
            return [];
        }

        // Strip out the junk.
        $presentation = str_replace('r>>>>>', '', $presentation);
        $presentation = trim(preg_replace('/\s+/', ' ', $presentation));
        $presentation = strip_tags($presentation);

        $options = explode('|', $presentation);
        $return = [(object)[
            'description' => 'Not selected'
        ]];

        foreach ($options as $index => $option) {
            switch ($type) {
                case 'multichoice':
                    array_push($return, (object)[
                        'description' => $option
                    ]);
                    break;
                case 'multichoicerated':
                    $optionArr = explode('#### ', $option);
                    array_push($return, (object)[
                        'description' => $optionArr[1],
                        'value' => $optionArr[0]
                    ]);
                    break;
                default:
                    // Unsupported type. 
                    return [];
                    break;
            }
        }

        return $return;
    }
protected function parseQuestionPresentation ($presentation, $type){

        // Text areas don't have options or scores
        if ($type == 'textarea') {
            return [];
        }

        // Strip out the junk.
        $presentation = str_replace('r>>>>>', '', $presentation);
        $presentation = trim(preg_replace('/\s+/', ' ', $presentation));
        $presentation = strip_tags($presentation);

        $options = explode('|', $presentation);
        $return = [(object)[
            'description' => 'Not selected'
        ]];

        foreach ($options as $index => $option) {
            switch ($type) {
                case 'multichoice':
                    array_push($return, (object)[
                        'description' => $option
                    ]);
                    break;
                case 'multichoicerated':
                    $optionArr = explode('#### ', $option);
                    array_push($return, (object)[
                        'description' => $optionArr[1],
                        'value' => $optionArr[0]
                    ]);
                    break;
                default:
                    // Unsupported type. 
                    return [];
                    break;
            }
        }

        return $return;
    }
protected function parseQuestionPresentation ( $ presentation , $ type ) { // Text areas don't have options or scores if ( $ type == 'textarea' ) { return [ ] ; } // Strip out the junk. $ presentation = str_replace ( 'r>>>>>' , '' , $ presentation ) ; $ presentation = trim ( preg_replace ( '/\s+/' , ' ' , $ presentation ) ) ; $ presentation = strip_tags ( $ presentation ) ; $ options = explode ( '|' , $ presentation ) ; $ return = [ ( object ) [ 'description' => 'Not selected' ] ] ; foreach ( $ options as $ index => $ option ) { switch ( $ type ) { case 'multichoice' : array_push ( $ return , ( object ) [ 'description' => $ option ] ) ; break ; case 'multichoicerated' : $ optionArr = explode ( '#### ' , $ option ) ; array_push ( $ return , ( object ) [ 'description' => $ optionArr [ 1 ] , 'value' => $ optionArr [ 0 ] ] ) ; break ; default : // Unsupported type.  return [ ] ; break ; } } return $ return ; }
Converts a feedback item "presentation" string into an array
@param [String => Mixed] $presentation
@param [String => Mixed] $type
@return [Array => Mixed]
Converts a feedback item presentation string into an array