plugin/exo/Serializer/Item/ItemSerializer.php
private function sanitizeScore($score)
    {
        $sanitized = ['type' => $score['type']];

        switch ($score['type']) {
            case 'fixed':
                $sanitized['success'] = $score['success'];
                $sanitized['failure'] = $score['failure'];
                break;

            case 'manual':
                $sanitized['max'] = $score['max'];
                break;

            case 'rules':
                $sanitized['noWrongChoice'] = isset($score['noWrongChoice']) ? $score['noWrongChoice'] : false;
                $sanitized['rules'] = $score['rules'];
                break;
        }

        return $sanitized;
    }
private function sanitizeScore($score)
    {
        $sanitized = ['type' => $score['type']];

        switch ($score['type']) {
            case 'fixed':
                $sanitized['success'] = $score['success'];
                $sanitized['failure'] = $score['failure'];
                break;

            case 'manual':
                $sanitized['max'] = $score['max'];
                break;

            case 'rules':
                $sanitized['noWrongChoice'] = isset($score['noWrongChoice']) ? $score['noWrongChoice'] : false;
                $sanitized['rules'] = $score['rules'];
                break;
        }

        return $sanitized;
    }
private function sanitizeScore ( $ score ) { $ sanitized = [ 'type' => $ score [ 'type' ] ] ; switch ( $ score [ 'type' ] ) { case 'fixed' : $ sanitized [ 'success' ] = $ score [ 'success' ] ; $ sanitized [ 'failure' ] = $ score [ 'failure' ] ; break ; case 'manual' : $ sanitized [ 'max' ] = $ score [ 'max' ] ; break ; case 'rules' : $ sanitized [ 'noWrongChoice' ] = isset ( $ score [ 'noWrongChoice' ] ) ? $ score [ 'noWrongChoice' ] : false ; $ sanitized [ 'rules' ] = $ score [ 'rules' ] ; break ; } return $ sanitized ; }
The client may send dirty data, we need to clean them before storing it in DB.

@param $score

@return array
The client may send dirty data we need to clean them before storing it in DB .