lib/serverdensity/Api/Tags.php
public function format($tags, $type)
    {
        $formattedTags = array();
        if ($type === 'user'){
            $formattedTags['tags'] = array();
            foreach($tags as $tag){
                $formattedTags['tags'][$tag['_id']] = array(
                    'mode' => 'readWrite'
                );
            }
        } else if ($type === 'other'){
            foreach($tags as $tag){
                $formattedTags['tags'][] = $tag['_id'];
            }
        } else {
            throw ErrorException("Only 'user' and 'other' are allowed types");
        }

        return $formattedTags;
    }
public function format($tags, $type)
    {
        $formattedTags = array();
        if ($type === 'user'){
            $formattedTags['tags'] = array();
            foreach($tags as $tag){
                $formattedTags['tags'][$tag['_id']] = array(
                    'mode' => 'readWrite'
                );
            }
        } else if ($type === 'other'){
            foreach($tags as $tag){
                $formattedTags['tags'][] = $tag['_id'];
            }
        } else {
            throw ErrorException("Only 'user' and 'other' are allowed types");
        }

        return $formattedTags;
    }
public function format ( $ tags , $ type ) { $ formattedTags = array ( ) ; if ( $ type === 'user' ) { $ formattedTags [ 'tags' ] = array ( ) ; foreach ( $ tags as $ tag ) { $ formattedTags [ 'tags' ] [ $ tag [ '_id' ] ] = array ( 'mode' => 'readWrite' ) ; } } else if ( $ type === 'other' ) { foreach ( $ tags as $ tag ) { $ formattedTags [ 'tags' ] [ ] = $ tag [ '_id' ] ; } } else { throw ErrorException ( "Only 'user' and 'other' are allowed types" ) ; } return $ formattedTags ; }
Format tags to be inserted
@param    array   tags    an array of tags
@param    string  type    either user or other
@return   formatted tags
Format tags to be inserted