original_string: public static function replaceTheGivenKeyFor($products, $oldKey, $newKey) : array
  	{
  		return $products->mapWithKeys(function ($item) use ($oldKey, $newKey) {
  
  			$features = $item->features;
  
  			$features[$newKey] = $features[$oldKey];
  			unset($features[$oldKey]);
  
  			return [$item->id => $features];
  		})->all();
  	}
code: public static function replaceTheGivenKeyFor($products, $oldKey, $newKey) : array
  	{
  		return $products->mapWithKeys(function ($item) use ($oldKey, $newKey) {
  
  			$features = $item->features;
  
  			$features[$newKey] = $features[$oldKey];
  			unset($features[$oldKey]);
  
  			return [$item->id => $features];
  		})->all();
  	}
code_tokens: public static function replaceTheGivenKeyFor ( $ products , $ oldKey , $ newKey ) : array { return $ products -> mapWithKeys ( function ( $ item ) use ( $ oldKey , $ newKey ) { $ features = $ item -> features ; $ features [ $ newKey ] = $ features [ $ oldKey ] ; unset ( $ features [ $ oldKey ] ) ; return [ $ item -> id => $ features ] ; } ) -> all ( ) ; }
docstring: Replaces the given key for another in the provided products features collection.
  
  @param  Collection $products
  @param  string $oldKey
  @param  string $newKey
  
  @return Collection
docstring_tokens: Replaces the given key for another in the provided products features collection .