original_string: public function addItem(PricedItemInterface $item)
      {
          if ($this->hasItem($item)) {
              return $this;
          }
  
          foreach ($this->items as $existingItem) {
              if ($item->equals($existingItem)) {
                  $existingItem->merge($item, false);
  
                  $this->itemsTotal = null;
                  $this->total = null;
  
                  return $this;
              }
          }
  
          $item->setContainer($this);
          $this->items->add($item);
  
          $this->itemsTotal = null;
          $this->total = null;
  
          return $this;
      }
code: public function addItem(PricedItemInterface $item)
      {
          if ($this->hasItem($item)) {
              return $this;
          }
  
          foreach ($this->items as $existingItem) {
              if ($item->equals($existingItem)) {
                  $existingItem->merge($item, false);
  
                  $this->itemsTotal = null;
                  $this->total = null;
  
                  return $this;
              }
          }
  
          $item->setContainer($this);
          $this->items->add($item);
  
          $this->itemsTotal = null;
          $this->total = null;
  
          return $this;
      }
code_tokens: public function addItem ( PricedItemInterface $ item ) { if ( $ this -> hasItem ( $ item ) ) { return $ this ; } foreach ( $ this -> items as $ existingItem ) { if ( $ item -> equals ( $ existingItem ) ) { $ existingItem -> merge ( $ item , false ) ; $ this -> itemsTotal = null ; $ this -> total = null ; return $ this ; } } $ item -> setContainer ( $ this ) ; $ this -> items -> add ( $ item ) ; $ this -> itemsTotal = null ; $ this -> total = null ; return $ this ; }
docstring: Add an item
  
  @param PricedItemInterface $item
  
  @return $this
docstring_tokens: Add an item