original_string: protected function updatePreferencesForKey(string $key, Collection $tags)
  	{
  		$tags = str_replace('"', '', $tags->implode(','));
  
  		$tags = Collection::make(explode(',', $tags))
  			->merge(explode(',',$this->preferences[$key]))
  			->unique()
  			->take(self::MAX_TAGS)
  			->implode(',');
  
  		$this->preferences[$key] = rtrim($tags, ',');
  	}
code: protected function updatePreferencesForKey(string $key, Collection $tags)
  	{
  		$tags = str_replace('"', '', $tags->implode(','));
  
  		$tags = Collection::make(explode(',', $tags))
  			->merge(explode(',',$this->preferences[$key]))
  			->unique()
  			->take(self::MAX_TAGS)
  			->implode(',');
  
  		$this->preferences[$key] = rtrim($tags, ',');
  	}
code_tokens: protected function updatePreferencesForKey ( string $ key , Collection $ tags ) { $ tags = str_replace ( '"' , '' , $ tags -> implode ( ',' ) ) ; $ tags = Collection :: make ( explode ( ',' , $ tags ) ) -> merge ( explode ( ',' , $ this -> preferences [ $ key ] ) ) -> unique ( ) -> take ( self :: MAX_TAGS ) -> implode ( ',' ) ; $ this -> preferences [ $ key ] = rtrim ( $ tags , ',' ) ; }
docstring: Updates the user references for a given key.
  
  @param  string $key
  @param  Collection $tags
  
  @return void
docstring_tokens: Updates the user references for a given key .