code: public function removeItem($item)
      {
          $key = array_search($item, $this->items, true);
  
          if ($key !== false) {
              unset($this->items[$key]);
          }
      }
docs: Removes the given item from the bag if it is found.
  
  @param mixed $item