static public function formatVariableToPci(ResponseVariable $var) {
        $value = $var->getValue();
        switch($var->getCardinality()){
            case 'single':
                if(strlen($value) === 0){
                    $formatted = ['base' => null];
                }else{
                    try {
                        $formatted = ['base' => [$var->getBaseType() => self::formatStringValue($var->getBaseType(), $value)]];
                    } catch (\common_exception_NotImplemented $e) {
                        // simply ignore unsupported data/type
                        $formatted = ['base' => null];
                    }
                }
                break;
            case 'ordered':
            case 'multiple':
                if(strlen($value) === 0){
                    $formatted = ['list' => [$var->getBaseType() => []]];
                }else{
                    preg_match_all('/([^\[\];<>]+)/', $value, $matches);
                    $list = [];
                    foreach($matches[1] as $valueString){
                        if(empty(trim($valueString))){
                            continue;
                        }

                        try {
                            $list[] = self::formatStringValue($var->getBaseType(), $valueString);
                        } catch (\common_exception_NotImplemented $e) {
                            // simply ignore unsupported data/type
                        }
                    }
                    $formatted = ['list' => [$var->getBaseType() => $list]];
                }
                break;
            default:
                throw new \common_Exception('unknown response cardinality');
        }
        return $formatted;
    }
static public function formatVariableToPci(ResponseVariable $var) {
        $value = $var->getValue();
        switch($var->getCardinality()){
            case 'single':
                if(strlen($value) === 0){
                    $formatted = ['base' => null];
                }else{
                    try {
                        $formatted = ['base' => [$var->getBaseType() => self::formatStringValue($var->getBaseType(), $value)]];
                    } catch (\common_exception_NotImplemented $e) {
                        // simply ignore unsupported data/type
                        $formatted = ['base' => null];
                    }
                }
                break;
            case 'ordered':
            case 'multiple':
                if(strlen($value) === 0){
                    $formatted = ['list' => [$var->getBaseType() => []]];
                }else{
                    preg_match_all('/([^\[\];<>]+)/', $value, $matches);
                    $list = [];
                    foreach($matches[1] as $valueString){
                        if(empty(trim($valueString))){
                            continue;
                        }

                        try {
                            $list[] = self::formatStringValue($var->getBaseType(), $valueString);
                        } catch (\common_exception_NotImplemented $e) {
                            // simply ignore unsupported data/type
                        }
                    }
                    $formatted = ['list' => [$var->getBaseType() => $list]];
                }
                break;
            default:
                throw new \common_Exception('unknown response cardinality');
        }
        return $formatted;
    }
static public function formatVariableToPci ( ResponseVariable $ var ) { $ value = $ var -> getValue ( ) ; switch ( $ var -> getCardinality ( ) ) { case 'single' : if ( strlen ( $ value ) === 0 ) { $ formatted = [ 'base' => null ] ; } else { try { $ formatted = [ 'base' => [ $ var -> getBaseType ( ) => self :: formatStringValue ( $ var -> getBaseType ( ) , $ value ) ] ] ; } catch ( \ common_exception_NotImplemented $ e ) { // simply ignore unsupported data/type $ formatted = [ 'base' => null ] ; } } break ; case 'ordered' : case 'multiple' : if ( strlen ( $ value ) === 0 ) { $ formatted = [ 'list' => [ $ var -> getBaseType ( ) => [ ] ] ] ; } else { preg_match_all ( '/([^\[\];<>]+)/' , $ value , $ matches ) ; $ list = [ ] ; foreach ( $ matches [ 1 ] as $ valueString ) { if ( empty ( trim ( $ valueString ) ) ) { continue ; } try { $ list [ ] = self :: formatStringValue ( $ var -> getBaseType ( ) , $ valueString ) ; } catch ( \ common_exception_NotImplemented $ e ) { // simply ignore unsupported data/type } } $ formatted = [ 'list' => [ $ var -> getBaseType ( ) => $ list ] ] ; } break ; default : throw new \ common_Exception ( 'unknown response cardinality' ) ; } return $ formatted ; }
Format a ResponseVariable into a associative array, directly usable on the client side.

@param ResponseVariable $var
@return array
@throws \common_Exception
Format a ResponseVariable into a associative array directly usable on the client side .