static private function formatStringValue($baseType, $stringValue){

        switch(strtolower($baseType)){
            case 'string':
            case 'duration':
                return $stringValue;
            case 'identifier':
                return self::trimIdentifier($stringValue);
            case 'integer':
                return intval($stringValue);
            case 'float':
                return floatval($stringValue);
            case 'boolean':
                return (trim($stringValue) === 'true' || $stringValue === true) ? true : false;
            case 'pair':
            case 'directedpair':
                $pair = explode(' ', trim($stringValue));
                if(count($pair) != 2){
                    throw new \common_Exception('invalid pair string');
                }
                return [self::trimIdentifier($pair[0]), self::trimIdentifier($pair[1])];
            case 'point':
                $pair = explode(' ', trim($stringValue));
                if(count($pair) != 2){
                    throw new \common_Exception('invalid point string');
                }
                return [intval($pair[0]), intval($pair[1])];
            default:
                throw new \common_exception_NotImplemented('unknown basetype');
        }
    }
static private function formatStringValue($baseType, $stringValue){

        switch(strtolower($baseType)){
            case 'string':
            case 'duration':
                return $stringValue;
            case 'identifier':
                return self::trimIdentifier($stringValue);
            case 'integer':
                return intval($stringValue);
            case 'float':
                return floatval($stringValue);
            case 'boolean':
                return (trim($stringValue) === 'true' || $stringValue === true) ? true : false;
            case 'pair':
            case 'directedpair':
                $pair = explode(' ', trim($stringValue));
                if(count($pair) != 2){
                    throw new \common_Exception('invalid pair string');
                }
                return [self::trimIdentifier($pair[0]), self::trimIdentifier($pair[1])];
            case 'point':
                $pair = explode(' ', trim($stringValue));
                if(count($pair) != 2){
                    throw new \common_Exception('invalid point string');
                }
                return [intval($pair[0]), intval($pair[1])];
            default:
                throw new \common_exception_NotImplemented('unknown basetype');
        }
    }
static private function formatStringValue ( $ baseType , $ stringValue ) { switch ( strtolower ( $ baseType ) ) { case 'string' : case 'duration' : return $ stringValue ; case 'identifier' : return self :: trimIdentifier ( $ stringValue ) ; case 'integer' : return intval ( $ stringValue ) ; case 'float' : return floatval ( $ stringValue ) ; case 'boolean' : return ( trim ( $ stringValue ) === 'true' || $ stringValue === true ) ? true : false ; case 'pair' : case 'directedpair' : $ pair = explode ( ' ' , trim ( $ stringValue ) ) ; if ( count ( $ pair ) != 2 ) { throw new \ common_Exception ( 'invalid pair string' ) ; } return [ self :: trimIdentifier ( $ pair [ 0 ] ) , self :: trimIdentifier ( $ pair [ 1 ] ) ] ; case 'point' : $ pair = explode ( ' ' , trim ( $ stringValue ) ) ; if ( count ( $ pair ) != 2 ) { throw new \ common_Exception ( 'invalid point string' ) ; } return [ intval ( $ pair [ 0 ] ) , intval ( $ pair [ 1 ] ) ] ; default : throw new \ common_exception_NotImplemented ( 'unknown basetype' ) ; } }
Format a string into the appropriate format according to the base type
@param $baseType
@param $stringValue
@return array|bool|float|int|string
@throws \common_Exception
Format a string into the appropriate format according to the base type