public static function unserializeAnnotations($annotations)
    {
        $returnValue = array();

        $reg = "/\s*@(subject|predicate|sourceLanguage|targetLanguage|source)[\t ]+(.+)(?:\s*|$)/u";
        $matches = array();
        if (false !== preg_match_all($reg, $annotations, $matches)){
            // No problems with $reg.
            if (isset($matches[1])){
                // We got some annotations.
                for ($i = 0; $i < count($matches[1]); $i++){
                    // Annotation name $i processing. Do we have a value for it?
                    $name = $matches[1][$i];
                    if (isset($matches[2][$i])){
                        // We have an annotation with a name and a value.
                        // Do not forget to unescape '--' that is not accepted in XML comments (see spec).
                        // (str_replace is unicode safe ;)!)
                        $value = $matches[2][$i];
                        $value = str_replace("\\-\\-", '--', $value);
                        $value = str_replace("\\\\", "\\", $value);
                        $returnValue[$name] = $value;
                    }
                }
            }
        }else{
            throw new tao_helpers_translation_TranslationException("A fatal error occured while parsing annotations '${annotations}.'");
        }

        return (array) $returnValue;
    }
public static function unserializeAnnotations($annotations)
    {
        $returnValue = array();

        $reg = "/\s*@(subject|predicate|sourceLanguage|targetLanguage|source)[\t ]+(.+)(?:\s*|$)/u";
        $matches = array();
        if (false !== preg_match_all($reg, $annotations, $matches)){
            // No problems with $reg.
            if (isset($matches[1])){
                // We got some annotations.
                for ($i = 0; $i < count($matches[1]); $i++){
                    // Annotation name $i processing. Do we have a value for it?
                    $name = $matches[1][$i];
                    if (isset($matches[2][$i])){
                        // We have an annotation with a name and a value.
                        // Do not forget to unescape '--' that is not accepted in XML comments (see spec).
                        // (str_replace is unicode safe ;)!)
                        $value = $matches[2][$i];
                        $value = str_replace("\\-\\-", '--', $value);
                        $value = str_replace("\\\\", "\\", $value);
                        $returnValue[$name] = $value;
                    }
                }
            }
        }else{
            throw new tao_helpers_translation_TranslationException("A fatal error occured while parsing annotations '${annotations}.'");
        }

        return (array) $returnValue;
    }
public static function unserializeAnnotations ( $ annotations ) { $ returnValue = array ( ) ; $ reg = "/\s*@(subject|predicate|sourceLanguage|targetLanguage|source)[\t ]+(.+)(?:\s*|$)/u" ; $ matches = array ( ) ; if ( false !== preg_match_all ( $ reg , $ annotations , $ matches ) ) { // No problems with $reg. if ( isset ( $ matches [ 1 ] ) ) { // We got some annotations. for ( $ i = 0 ; $ i < count ( $ matches [ 1 ] ) ; $ i ++ ) { // Annotation name $i processing. Do we have a value for it? $ name = $ matches [ 1 ] [ $ i ] ; if ( isset ( $ matches [ 2 ] [ $ i ] ) ) { // We have an annotation with a name and a value. // Do not forget to unescape '--' that is not accepted in XML comments (see spec). // (str_replace is unicode safe ;)!) $ value = $ matches [ 2 ] [ $ i ] ; $ value = str_replace ( "\\-\\-" , '--' , $ value ) ; $ value = str_replace ( "\\\\" , "\\" , $ value ) ; $ returnValue [ $ name ] = $ value ; } } } } else { throw new tao_helpers_translation_TranslationException ( "A fatal error occured while parsing annotations '${annotations}.'" ) ; } return ( array ) $ returnValue ; }
Unserialize an RDFTranslationUnit annotation and returns an associative
where keys are annotation names, and values are the annotation values.
Throws TranslationException.

@access public
@author Jerome Bogaerts <jerome@taotesting.com>
@param  string annotations The annotations string.
@return array
Unserialize an RDFTranslationUnit annotation and returns an associative where keys are annotation names and values are the annotation values . Throws TranslationException .