original_string: public function set($product_id, array $products)
      {
          $this->delete(array('product_id' => $product_id));
  
          $added = $count = 0;
          foreach ($products as $product) {
  
              $count++;
  
              $data = array(
                  'product_id' => $product_id,
                  'item_product_id' => $product['product_id']
              );
  
              if ($this->add($data)) {
                  $added++;
              }
          }
  
          return $count && $added == $count;
      }
code: public function set($product_id, array $products)
      {
          $this->delete(array('product_id' => $product_id));
  
          $added = $count = 0;
          foreach ($products as $product) {
  
              $count++;
  
              $data = array(
                  'product_id' => $product_id,
                  'item_product_id' => $product['product_id']
              );
  
              if ($this->add($data)) {
                  $added++;
              }
          }
  
          return $count && $added == $count;
      }
code_tokens: public function set ( $ product_id , array $ products ) { $ this -> delete ( array ( 'product_id' => $ product_id ) ) ; $ added = $ count = 0 ; foreach ( $ products as $ product ) { $ count ++ ; $ data = array ( 'product_id' => $ product_id , 'item_product_id' => $ product [ 'product_id' ] ) ; if ( $ this -> add ( $ data ) ) { $ added ++ ; } } return $ count && $ added == $ count ; }
docstring: Delete old and add new bundled items for the product
  @param int $product_id
  @param array $products
  @return bool
docstring_tokens: Delete old and add new bundled items for the product